How to Create and Delete Hyper-V Checkpoints / Snapshots

Checkpoints (see this article for a definition) can be useful for short-term testing when you need a quick way to revert a Hyper-V virtual machine to its prior state, for example, before updating Windows or installing software.

To create and delete checkpoints (aka. snapshots in older versions of Windows Server and Hyper-V), you can issue the following commands from the command line.

To run the commands you’ll need to invoke PowerShell, which resides in the folder:

%systemdrive%\Windows\System32\WindowsPowerShell\v1.0

 

The scripts below are ready to copy and paste to your batch files (or into BackupChain if need be), for whatever purpose you need them:

 

Creating Hyper-V Checkpoints / Snapshots

The actual PowerShell command for creating a checkpoint is:

Checkpoint-VM -Name w7 -SnapshotName WorkingSystem

Where “w7” is the virtual machine name and “WorkingSystem” is the desired checkpoint name.

To package the whole thing into a one-liner that can be launched from the command prompt, or from inside a batch file, we invoke PowerShell as follows:

%systemdrive%\Windows\System32\WindowsPowerShell\v1.0\powershell -command "Checkpoint-VM -Name w7 -SnapshotName testsnapshotname"

 

In order to remotely create a checkpoint for VM “w7” on server “MyHyperVHostName”, we can run the command as follows:

%systemdrive%\Windows\System32\WindowsPowerShell\v1.0\powershell -command "Get-VM W7 –ComputerName MyHyperVHostName | Checkpoint-VM"

 

Deleting Hyper-V Checkpoints / Snapshots

The command to delete Hyper-V checkpoints is similar but offers more options:

%systemdrive%\Windows\System32\WindowsPowerShell\v1.0\powershell -command "Get-VM w7 | Remove-VMSnapshot –Name testsnapshotname"

Other variations are possible, too, such as deleting all checkpoints whose names begin with a certain phrase:

%systemdrive%\Windows\System32\WindowsPowerShell\v1.0\powershell -command "Get-VM w7 | Remove-VMSnapshot –Name OldSnapshotName*"

And even slicker is the following command, which deletes snapshots of a certain age, here 30 days:

%systemdrive%\Windows\System32\WindowsPowerShell\v1.0\powershell -command "Get-VMSnapshot -VMName w7| Where-Object {$_.CreationTime -lt (Get-Date).AddDays(-30) } | Remove-VMSnapshot"

 

Backing up VMs with Checkpoints in Hyper-V

As mentioned by Microsoft, when it comes to Hyper V backup, “Checkpoints Are Not Intended for Backup”: (https://technet.microsoft.com/en-us/library/Cc956044.aspx)

In order to have your important Hyper-V VMs backed up and protected, use BackupChain Backup Software. It handles and restores checkpoints automatically, and VMs may also be restored as clones, side-by-side with the original VM without interference.

 

You may also be interested in

Hyper-V NAS Backup on Synology, Qnap, Netgear, Drobo, Buffalo

Hyper-V Fixed Disk Backup Considerations

Hyper-V Backup Pass-through Disk Considerations

Dynamic Disk Hyper-V Backup Considerations

USB Disk Hyper-V Backup Considerations

Pros and Cons of Deduplication Technologies, VHDX, Hyper-V

BackupChain Overview

Download BackupChain
How to Backup Hyper-V VMs
How to Backup to the Cloud
How to Backup VMware Workstation
How to Backup over FTP
How to Backup VirtualBox VMs
How to Backup Large Files and Folders

Popular

Resources


Backup Software Solution List
BackupChain
Veeam
Unitrends
Symantec Backup Exec
BackupAssist
Acronis
Zetta
Altaro
Windows Server Backup
Microsoft DPM
Ahsay
CommVault
IBM

Download BackupChain®