Managing Snapshots with PowerCLI

With access to vCenter or vRealize Automation comes great responsibility. Clients often require a quick and easy way to take a short term snapshot of a server so that they can quick and easily rollback application changes. VMware provides a robust snapshot function, however when things go well these snapshots are often left behind or forgotten about.

Run PowerCLI and run the below commands to get a list of all VMs with a Snapshot

To make the output a little nicer on the eye, run the following command

To limit the results to only snapshots that are greater than 7 days old, run the following command

To remove all snapshots from a server, run the below command. Include the -RunAsync command to run the snapshot removal as a background task instead of waiting for the removal to complete.

I have also written a basic PowerShell tool to manage Snapshots. If you encounter any issues with it, just let me know via the Contact page and I will happily provide assistance.

SnapshotManagement.ps1

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.