Hyper-V doesn’t require much maintenance, but once in a while you may see a checkpoint (formerly called snapshot) attached to a virtual machine (VM) that cannot be deleted because the option to delete is unavailable. I have encountered this on Hyper-V running on a Windows Server 2012 R2 Datacenter. One day something went wrong with the server backup and I noticed a checkpoint that I did not create. It was created by a third-party application that I used to backup checkpoints. The checkpoint was called ServerName – Backup, where ServerName was the name of the VM. I wanted to export the VM and didn’t want to have any checkpoints in the backup. I already had a backup of the VM and everything was working fine so I didn’t really care about the backup that system created. When I right-clicked the checkpoint to delete it, I noticed that the option Delete Checkpoint was not available. Here’s what I saw.
Notice that the options to Delete Checkpoint and Delete Checkpoint Subtree are missing in the above screenshot. Here’s what the options are for a standard checkpoint.
If you run into this situation, first try the following techniques.
- Right-click the host server name in the Hyper-V Manager in the left-hand pane and select Refresh.
- Close and re-open the Hyper-V Manager.
- Highlight the checkpoint and use the Delete key on the keyboard.
If none of these tips help, then use the PowerShell to get rid of unwanted checkpoint(s). This applies to any checkpoint that you want to delete.
PowerShell Script to Delete a Checkpoint (Snapshot)
To delete a checkpoint in Hyper-V, use the following instructions. The script should work on Hyper-V installed on any operating system, e.g. Windows Server 2008, Windows Server 2012, Windows Server 2016, Windows 10, etc.
- Start PowerShell on the computer where the virtual machine is located. I prefer to use PowerShell ISE.
- Type the following command and press Enter. The VMSnapshot parameter refers to the VM checkpoint. As I mentioned earlier, the checkpoint used to be called snapshot in Hyper-V before Microsoft changed its name.
Get-VMSnapshot -ComputerName <Name-of-Computer> -VMName <Name-of-VM> | Remove-VMSnapshot
The vertical bar is the pipe symbol above the Enter key on a standard keyboard. If your computer is called SERVER1 and the name of the virtual machine is SQLServer, you will use the following command. Make sure you use the name of the VM, not the name of the checkpoint . The following command will work if you have only one checkpoint that needs to be deleted. The -ComputerName <Name-of-Computer> parameter is optional, but you must specify the VMName parameter. In other words, either one of the following commands should work.
Get-VMSnapshot -ComputerName “SERVER1” -VMName “SQLServer” | Remove-VMSnapshot
Get-VMSnapshot -VMName “SQLServer” | Remove-VMSnapshot
- If you have more than one checkpoints then use the -Name <Checkpoint-Name> parameter at the end. For example, if the VM is called CONTOSO and the checkpoint you want to delete is called CONTOSO – (9/6/2018 – 8:07:13 PM), then the command would like this:
Get-VMSnapshot -VMName “CONTOSO” -Name “CONTOSO – (6/20/2018 – 10:48:49 AM)” | 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.
Article Updated: 9/13/18
Copyright © 2017 SeattlePro Enterprises, LLC. All rights reserved.