Wednesday, June 29, 2011

Report on all VMs with snapshots using Vsphere PowerCLI

The first step is to connect to your VC from vSphere PowerCLI with the following command:

Connect-ViServer VCServerName

The second command lists all of the VMs, finding the shapshots, looking up what host currently houses the VM and then creating the actual table:

Get-VM | Get-Snapshot | Select-Object VM, Name, Description, PowerState, Created, @{Name="Host"; Expression = {(Get-VM $_.VM).Host.Name}} | ft -auto

The Output Screen looks like following:

VM                               Name                                                 Description
----                                --------                                               --------------
Test1Server                 Before upgrade                                 Pre software version 2 upgrade
Test2Server                 Pre SP2 install                                  Pre Windows 2003 SP2 Install

No comments:

Post a Comment