• Jitendra Singh

How to Get Snap shot Report of all Parent VMs


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

Also See how to clear Oldest Snap shot from All Parents after successful recompose operations and Validation.

#Automation #vSphere #horizonview

104 views

Tel: +91-8879374285

 Bangalore INDIA 560076

© 2017-18 Xtra-V!rtual