Snapshots are the most widely used features in vSphere environment. Ever since this feature was introduced by VMware it has been popular among customers. But many a times VM level snapshots are mislead with virtual machine backup which creates lot of performance issues and administrators have to spend numerous hours to fix it.
Refer to VMware KB 1015180 for more details on what is Snapshot and how does it works
VMware best practice says although a VM can have maximum of 32 chain-snapshots but for optimum performance it shouldn’t have more than 2-3 snapshots. Any single snapshot older than 24-72 hours can also cause severe performance issues because snapshot grows along with its associated .vmdk file
However it is equally tricky task for large enterprises to keep track of VM Snapshots and regularly keep deleting older snapshots. There are 3rd party tools available in market but sometimes it conflicts with organizational compliance policies which restricts them to deploy such 3rd party applications in their environment.
So here is a small PowerShell script to solve the purpose which not only gather VM details which has snapshot associated with it but also checks its size, creation date and saves it in .csv format.
Please refer pre-requisites to run this script from my older blog
Connect-VIServer -Server server_fqdn -User username -Password passwd Add-PSSnapin VMware.VimAutomation.Core -ErrorAction 'SilentlyContinue' Clear-Host $e = Get-VM | Get-Snapshot $f = $e | Select-object vm,VMId,name,Description,SizeGB,created $f | Export-Csv -Path "C:\path_name\snapshot.csv"
With this I end this blog… I hope it helps… till then Happy Reading… 🙂