29/04/19

VMWARE - Get snapshots and size of VMs


Today I need to check the snapshots of all VMs of a VMware infrstructure. Unfortunately I have found that with vSphere Client and vSphere Web Client it's not possibile to get a list of snaps associated to VMs.

So, after a advanced google search, I have found that this is possibile using VMware PowerCLI tools.
I've installed the version 5.5 available in this page https://code.vmware.com/web/tool/5.5/vmware-powercli

After this, I use powershell for loading the snapin and connect to my vcenter server with this:

add-pssnapin vmware.vimautomation.core
connect-viserver myvcentersrv_FQDN


Then with the commmand I get the list with VM name, number of snapshot and size:

Get-VM | Format-Table Name, @{Label="NumSnapshots";Expression={(Get-Snapshot -VM $_ | Measure-Object).Count}}, @{Label="TotalSnapShotSizeMB";Expression={(Get-Snapshot -VM $_ | Measure-Object -Sum SizeMB).Sum}}

Ref: http://www.vhersey.com/2016/03/01/quick-powercli-to-get-snapshots-and-size/

Nessun commento :

Posta un commento