Winning converts to PowerShell through VMWare

We recently upgraded to VMware 3.5. One of the reasons was Update Manager and it's ability to automate vmotion and patching. This was really cool. Turns out, there is a 'gotcha'. You can't automatically use update manager to vmotion a system that has the CD Rom drive connected. My co-worker discovered this on a update of a test environment and discussed this with support, their answer was to check all the systems. As I was going to be helping do this on a Saturday evening, late, I didn't like this answer so much on checking a hundred guest systems manually.

VMware recently released their VMware Infrastructure Toolkit (for Windows) 1.0 Beta. Requires PowerShell, neat! I like PowerShell. Not so good at it yet, but still, learning is fun and probably better then checking a hundred guest systems configuration. I mentioned this to my co-worker that there may be a better solution than manually checking each server manually. He laughed and asked, "That PowerShell stuff?"

Looking at the original announcement I thought well, there's the solution right there, third example.

Get-VM | Get-CDDrive | ? { $_.ConnectionState.Connected -eq "true" } | Set-CDDrive -Connected:$false -Confirm:$false

Being new to this toolkit, we were hesitant to use an automation script that we didn't really understand or test. So I found ,from Carter Shanklin, in the forums this script that let me report on which servers had connections and let us deal with them manually for now.

get-vm | where { $_ | get-cddrive | where { $_.ConnectionState.Connected -eq "true" } } | select Name

While browsing the forums I came across mention of finding and reporting on snap shots. I remember the other admins mentioning those little space vampires not being cleaned up regularly so I ran it and found a few created a few months ago and we were able to get those cleaned up as well. Note: I lost the link so cannot properly credit source

$snap = get-vm | get-snapshot
$snap | ft @{l = "VM"; e = {$_.vm.name} },name,created,description

Further testing of the original CD Rom disconnect script shows it does work as advertised. The other VMware admins are liking it enough that they are installing PowerShell and the VMware Infrastructure Toolkit (and Quest cmdlets too). Automation is a good thing. More people local to me figuring out uses for PowerShell also fun.

Commenting on this Blog entry is closed.