If you use HYPER-V probably you have work with Checkpoints in production or LAN environment.
Checkpoints it's and easy and safe way to revert the Virtual Machines in previous state if something going wrong when do a critical change.
In the past i wrote an article How to Work with HYPER-V CheckPoints which explain how can use Checkpoints.
Sometimes maybe need to create Checkpoints of the Virtual Machine from Powershell. For example if you use Windows Server 2012 R2 Core you can't do it from GUI.
Today i will explain how can create a Checkpoint of VM from Powershell
- Open HYPER-V Manager just to watch what's going on when run the powershell commands
- Open Powershell
- Run the following command to create a checkpoint
Checkpoint-vm -name bckserver -snapshotname beforecreatenewvm"
- You can see the status from Powershell or from HYPER-V Manager
- Now you can run the following command to see how many checkpoints you have in specific Virtual Machine
Get-vmsnapshot -vmname bckserver
- If you want to apply a checkpoint in Virtual Machine just run the following command and watch from HYPER-V Manager the Progress
Restore-VMSnapshot -name :beforecreatenewvm" -VMName bckserver
- In case that you want to delete the Checkpoint you can run the following command
Get-VM bckserver | Remove-VMSnaphot -Name "beforecreatenewvm"
With these commands you can manage Checkpoints of Virtual Machine from HYPER-V.
It's not difficult and you can practice in your Lab before use it in Production environment.