The first steps to restore your virtual machine are identical to the steps desribed in my previous post.
Add-PSSnapin Microsoft.SystemCenter.VirtualMachineManager Get-VMMServer -ComputerName “<ComputerName> | out-null
To be able to restore using powershell you need to know your servername and the checkpoint name. The command to restore your checkpoint is ‘get-VMCheckpoint –VM <Server> | where{$_.Name -eq “<CheckPoint name>”} | restore-VMCheckpoint | out-null
The above command will silently restore your virtual machine.
You enter the following if you want to wait till your restore is finished before the script continues.
do { Write-Host "$ServerName$ServerNumber is restoring to last checkpoint" -foregroundcolor cyan </span><span style="color: #000000;">$CheckPointStatus = $SelectedVM.MostRecentTask</span><span style="color: #000000;">start-sleep -seconds 3</span> <span style="color: #000000;">} until($CheckPointStatus.status -eq "Completed" -and $CheckPointstatus.name -eq "Restore from checkpoint")