How to Get Snapshot Details for all the Parent VMs from the vCenter
Often we need to check how many snapshots we have on our Parent VMs or other Virtual machines.
A general use case for a VDI administrator is to keep track of the number of snap shots available on all parent machines in VDI environment.
Best practice is to keep max 3-4 Snapshots for backup purpose.
How to get snap shot report ? how to do a clean up of unwanted snap shots...
This is really simple with VMware Power CLI. To download and install Power CLI 12.1.0 click here
for this task we will have a small script which will get snap shot report for us, script as below(edit as per your environment)
#import vmware module and connec to vCenter server
#connect to the vCenter Server (change vcenter server name and username password as per your environment)
Connect-Viserver "vcs01.vclass.local" -username vclass\admin -passsword Password@123
$foldername = "folder1", "folder1"
$vm = Get-VM -Location $foldername | select -ExcludeProperty Name
# Now create an object to store out put
$record = @()
# Apply a loop for each VM, Get snap shot information and save the same into the object
foreach ($vm in $vm)
$snapshot = Get-snapshot -vm $vm
$count = $snapshot.count
$record = "" | select VMname, Snapshotcount
$record.VMName = $vm
$record.Snapshotcount = $count
$records += $record
#display information stored in object once loop ends.
# we should know which vCenter inventory Folder Parent machines are available , put all VMs into a single variable
This will display VM name and snap shot count in a tabular format.