Hyper-V checkpoints can help an administrator roll back changes in the event of a problem by taking point-in-time...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
images of Hyper-V VM. For example, you can take checkpoints of a VM, perform your application testing and revert the checkpoint to a known state if you need to retest. Although you can use Hyper-V Manager to perform checkpoint tasks, it's easier to do the same tasks using PowerShell.
By default, Hyper-V checkpoints aren't enabled on VMs. In order to execute the PowerShell commands below, you'll be required to enable checkpoints on the VMs. You can use the Hyper-V Manager to enable checkpoints for a VM, but you can also execute the Set-VM PowerShell cmdlet. To enable checkpoints for a single VM, execute the Set-VM –Name SQLVM –CheckPointType Enable PowerShell command. Next, run Set-VM –Name SQLVM –CheckPointType ProductionOnly to configure the VM to use a production checkpoint -- first introduced in Hyper-V 2016.
Once you have enabled checkpoints for a VM, you can execute the below PowerShell commands to take checkpoints or revert to a checkpoint of your choice.
Create a checkpoint
To create a checkpoint, use the CheckPoint-VM PowerShell cmdlet. Just executing CheckPoint-VM –Name SQLVM will create a checkpoint for an SQLVM. If you need to take another checkpoint, execute the same command. Note that when you take a checkpoint, Hyper-V creates a checkpoint entry with the date and time when the checkpoint was taken.
To list all of the Hyper-V checkpoints for a VM, use Get-VMSnapshot –VMName SQLVM.
Note that the Checkpoint-VM PowerShell cmdlet doesn't support taking checkpoints for a VM running on a remote Hyper-V host. If you need to perform a checkpoint for a remote VM, interact with the remote VM using the Get-VM PowerShell cmdlet and then pipe the Checkpoint-VM cmdlet as shown in the command below:
Get-VM Remote_SQLVM –ComuterName RemoteHyper-VHost | Checkpoint-VM
By using the command above, you are performing a checkpoint for a VM that is running on RemoteHyper-VHost.
To restore or revert to a checkpoint for a VM, use the Restore-VMSnapshot PowerShell cmdlet. If you would like to restore an SQLVM to a previous checkpoint, execute the PowerShell commands below:
$ThisVM = “SQLVM”
$ThisVM | Get-VM | Get-VMSnapshot –Name “SnapshotName” | Restore-VMSnapshot –Confirm:$False
Note that you will be required to stop the VM before performing the checkpoint restore operation.
Learn about the different Hyper-V checkpoints
Navigate the new features in Hyper-V 2016
Perform a Hyper-V health check with PowerShell
Dig Deeper on Microsoft Hyper-V management
Related Q&A from Nirmal Sharma
PowerShell is just one way to trigger AD synchronization when troubleshooting, making configuration changes or ensuring a consistent copy of ...continue reading
Windows Server 2016 provides advanced security for VMs and enables the user to boot Linux VMs securely and to hot add and remove network cards and ...continue reading
A misconfigured SCVMM service template can cause serious headaches. Before deploying service templates in production, validate them with SCVMM ...continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.