Tuesday, July 19, 2011

Find VM snapshots & delete VM snapshots using PowerCLI

The following will show all VM's in the connected vCenter environment that have snapshots and will output the information showing the VM name, snapshot name and snapshot creation date.

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


The following will remove all snapshots with an associated VM.

Get-VM "ServerName" | Get-Snapshot | Remove-Snapshot -confirm:$false -RunAsync


This is just for my own personal reference really when I want to quickly check the environment I'm working in.

A fully featured and robost script can be run in the environment using virtu-al.net's vCheck script. I recommend checking it out as it is pretty amazing;

http://www.virtu-al.net/featured-scripts/vcheck/

No comments:

Post a Comment