Tuesday, August 13, 2013

PowerCLI: How To Find Snapshots in vCenter

I've been noticing a few stray/orphaned snapshots left by our new backup solution and was looking for a way to quickly locate them using PowerCLI.

1. Launch PowerCLI 5.1 as administrator, then connect to your vCenter server with the following command:

Connect-VIServer –Server "myvcenterserver" -Protocol https –User "myusername" –Password "mypassword"

Enter the appropriate info for "myvcenterserver", "myusername"and  "mypassword".

2. After connecting to your vCenter server, run the following command to query vCenter and find all of your open snapshots:

Get-VM | Get-Snapshot | Select Created, VM


The output will display the date and time the snapshot was created and the VM name.

To export to csv:
Get-VM | Get-Snapshot | Select Created, VM | export-csv C:\temp\snapshots.csv

Happy Hunting.

No comments:

Post a Comment