PowerShell Script to Delete a Checkpoint (Snapshot) using Remove-VMSnapshot

0
Remove-VMSnapshot

To delete a checkpoint in Hyper-V, use the following instructions.

Start PowerShell on the computer where the virtual machine is located.

Type the following command and press Enter to get a list of snapshots
Get-VMSnapshot -VMName TestVM

Take note (copy) the snapshot name you wish to remove

Run the command below to remove the snapshot

Get-VMSnapshot -VMName TestVM -Name “Name Of Snapshot” | Remove-VMSnapshot

You can also run the below to remove all Snapshots

Get-VM TestVM | Remove-VMSnapshot -Name *

To remove any Snapshots older than a given number of days use

Get-VMSnapshot -VMName TestVM | Where-Object {$_.CreationTime -lt (Get-Date).AddDays(-90) } | Remove-VMSnapshot

As soon as the checkpoint is deleted, Hyper-V will start the merge process in the Hyper-V Manager. Depending on the size of the virtual hard disk, the merge process may take some time so be patient.

If you need to export the virtual machine, you will be able to proceed once the merge is complete.

Found priceless insights in this blog? Support the author’s creativity – buy them a coffee!

Leave a Reply

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