Category Archives: Powershell

Advancing the Function

AdvFunctionRecently I had to grab some general info on a group of VMs in a particular folder within vSphere.  Typical stuff like, Guest OS, # vCPUs, RAM, Disk, etc. I looked around my scripts folder as I was sure I had written a small script to accomplish this task previously but came up empty. No problem, I’ll just whip something up I thought. Then my mind starts racing, will the script output to csv? html? Excel? Word? I could include all options (and code) and let the user choose? What parameters will I need and how will I validate them? This script was getting cumbersome already and I hadn’t even thought about the simple info I needed to query. Then it dawned on me…all I needed was the data. I decided to strip the function down to simply gathering the information I needed. If I wrote a proper advanced function, then I could just return the gathered objects down the pipeline and from there format the output as needed.

Simply put, an advanced function acts very much like a standard cmdlet.

Continue reading

Deploying multiple VMs via PowerCLI – Updated v1.2

DeployVMv1.2

I’ve gotten some great feedback from my original PowerShell/PowerCLI script to deploy multiple VMs asynchronously via a CSV file found here.  I decided a minor update was needed to employ these new ideas along with a few I had myself.

One of those ideas was to require the usage of the new PowerCLI 5.5 R2 features which allows the script to run without the need for a 32bit PowerShell console.

Changes include:

  • Cleaned up code / Minor bug fixes
  • Added CSV field descriptions to notes section
  • Removed requirement for 32bit PowerShell
  • Added requirement for PowerCLI 5.5 R2 or later
  • Added Boot parameter to determine whether or not to power on new VMs
  • Added OS Customization Spec to CSV (previously was hard coded in user variables)
  • Fixed logic for vSS vs vDS – Added parameter to CSV
  • Added ability to use DHCP instead of just static IPs
  • Renamed a few CSV fields to better describe parameter
  • Added progress bar to indicate status

Continue reading

What is vCheck?

poshable

As a VMware admin there are a plethora of tools to assist you in gaining visibility into your virtual environment.  I’ve seen folks layer on three or four tools at a time in an attempt at getting the best insight into what is going on under the virtual covers. Some of these tools excel in different areas though I have rarely found one that fits all needs. Almost all will have some sort of alerting capability to let you know when something has gone south and many of these products cost in the tens of thousands of dollars.

If there was one tool that was an absolute must have for me – vCheck – hands down.

And the best part? It’s free!
Now, vCheck is not going to replace all those shiny, expensive tools but for a single report that gives you an overview of what you are walking into in the morning, it can not be beat.

Continue reading

PowerCli Update – PowerCLI 5.5 R2

VMware has rolled out a few updates this week with the release of vSphere 5.5 Update 1. The majority of the products involved all got some sort of bump/patch as well as the addition of VSAN. Not to be outdone, Alan and his team also released PowerCli 5.5 R2 (Build 1649237). It is wonderful to see grand improvements in a product I use everyday.

A full rundown of the new features and download link can be found here.

It just may be time to give a serious look at updating to PowerShell 4.0 as with this update, PowerCli is fully compatible. Time to start looking at other plugins as well and determine what dependencies might have issues.

Another one of the new features that caught my eye was this:

64 bit Support

The New/Set-OSCustomizationSpec cmdlets have been updated to work in 64-bit PowerShell and no longer require running in a 32-bit PowerShell environment.

This will help my VM Deployment script as you will now longer have to run in 32bit mode.  I’ll be checking this out and updating shortly.

Updating Remote Passwords with PowerShell

Changing passwords is always one of those fun tasks for any admin. It becomes even more challenging when your a Windows admin over hundreds of individual servers that are not part of the same domain.  Here’s my take on a PowerShell script to change the password of a local user on a remote system (or many remote systems), regardless of domain status.

Continue reading