Delete VMware VM Snapshots using PowerCLI

Removing the old snapshots of the Virtual Machine is one of the easiest ways that a virtualization administrator can reclaim storage capacity in their environment.

Unlike reclaiming other resources like CPU or Memory, deleting old snapshots doesn’t require downtime. Now, many of us are guilty of having snapshots that are months old, and sometimes for reasons, we can’t even remember. But unless you have a tool like vRealize Operations Manager, finding and deleting old snapshots can be a lengthy manual process.

There are multiple ways to find the old/stale VM snapshots, you can leverage some smart tools like RVTools to get the snapshots and creation date

or you can write a small PowerCLI script to quickly check and delete the snapshots of the Virtual Machine in the vSphere environment

Get-VM will list all the VMs, you can use regex filter in the Name option

Get-VM -Name asvignesh-*

You can get the snapshots of the VMs using

Get-VM | Get-Snapshot

To get and delete all the snapshots you can use

Get-VM -Name asvignesh-* | get-snapshot | remove-Snapshot 

Also published on Medium.

Default image
Vignesh A Sathiyanantham
AWS Certified developer with 8 years of extensive experience working for Cloud and Datacenter solutions and leading a small team in a lean startup based on Bangalore, India

Leave a Reply

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