lunedì, aprile 29, 2019

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

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}}


Nessun commento :

Posta un commento