VMware Cloud Community
Guv
Enthusiast
Enthusiast

VM's and how many snapshots they have.

Is it possible to get a script to list all VM' in a virtual centre and list the number of snapshots for each VM, or list the VM's which have snapshots and list how many snapshots they have.

Is this possible.

Thanks

0 Kudos
2 Replies
Grzesiekk
Expert
Expert

Hi,

  the quickest way to check vm names which have snapshot is this as far as i know

Get-View -ViewType VirtualMachine -Filter @{"snapshot" = ""} | select name

And for the output like you asked:

get-vm testgk| select Name,@{N='How many Snapshots';E={($_|get-snapshot).count} }

vmname      How many Snapshots
testvm       2

by the way, you should also take this into consideration when looking for snapshots
http://psvmware.wordpress.com/2012/07/17/watch-out-for-snapshots/

Greg
--- @blog https://grzegorzkulikowski.info
0 Kudos
Chrisxxxx
Contributor
Contributor

This is a little report I wrote for myself, in case it helps.  (These snapshots happened to not have a description.)

$> get-vm | get-snapshot | sort vm,created | select vm,powerstate,created,sizemb,iscurrent,parent,name,description | ft -AutoSize

VM   PowerState Created                SizeMB IsCurrent Parent                       Name                         Description
--   ---------- -------                ------ --------- ------                       ----                         -----------
vm1  PoweredOn 6/4/2012 10:02:56 AM  16313.75      True                              Upgrade ODBC connection
vm2  PoweredOn 9/17/2011 6:20:24 PM   2049.19     False                              Clean Install - Files Copied
vm2  PoweredOn 9/17/2011 9:08:17 PM   2794.19      True Clean Install - Files Copied Working!

0 Kudos