Contact Sales
Hosting (IT)

Getting a list of snapshots in vSphere using PowerCLI

Hosting

Posted 05/06/2017

If you don’t like to use the GUI to get certain stats or reports, you can always use PowerCLI.  PowerCLI is the Windows PowerShell interface for managing VMware vSphere.

There's a very simple script that will return the list of snapshots that are in your environment.  It is good to occasionally get a report on the number snapshots in your environment as sometimes they are forgotten, not removed from another application or if a VM is running off a snapshot which can degrade the performance of that VM if it gets too big, not to mention take up space.

First, you’ll need to launch PowerCLI or load the PowerCLI modules into your Windows Powershell window:

add-pssnapin vmware.vimautomation.core

Then you’ll need to connect to you vCenter:

connect-viserver “IP/ hostname/FQDN of vCenter”

Once connected you can execute the following command:

get-vm | get-snapshost | select, vm, name, description, created, sizegb

Select the relevant headings for you.  The above gets the name of the VM, the name of snapshot, the description, when it was created and the size.

Find out more about our cloud hosting solutions