Enable standard checkpoint on VM for snapshot if disabled
This commit is contained in:
parent
04f7215b5e
commit
630bc6540d
|
@ -10,7 +10,14 @@ $ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$VM = Hyper-V\Get-VM -Id $VmId
|
$VM = Hyper-V\Get-VM -Id $VmId
|
||||||
|
$ChkPnt = $VM.CheckpointType
|
||||||
|
if($ChkPnt -eq "Disabled") {
|
||||||
|
Hyper-V\Set-VM -VM $VM -CheckpointType "Standard"
|
||||||
|
}
|
||||||
Hyper-V\Checkpoint-VM $VM -SnapshotName $SnapName
|
Hyper-V\Checkpoint-VM $VM -SnapshotName $SnapName
|
||||||
|
if($ChkPnt -eq "Disabled") {
|
||||||
|
Hyper-V\Set-VM -VM $VM -CheckpointType "Disabled"
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
Write-ErrorMessage "Failed to create snapshot: ${PSItem}"
|
Write-ErrorMessage "Failed to create snapshot: ${PSItem}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in New Issue