Often we need to check how many snap shots 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 2-3 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 6.5 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
Import-Module VMware.VimAutomation.Core
#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 } $records #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 as a table format