From 630bc6540d95f42dc09af3686ce45ea7690de61f Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Fri, 6 Jul 2018 15:29:07 -0700 Subject: [PATCH] Enable standard checkpoint on VM for snapshot if disabled --- plugins/providers/hyperv/scripts/create_snapshot.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/providers/hyperv/scripts/create_snapshot.ps1 b/plugins/providers/hyperv/scripts/create_snapshot.ps1 index 4a61acf68..8b98f1c6e 100644 --- a/plugins/providers/hyperv/scripts/create_snapshot.ps1 +++ b/plugins/providers/hyperv/scripts/create_snapshot.ps1 @@ -10,7 +10,14 @@ $ErrorActionPreference = "Stop" try { $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 + if($ChkPnt -eq "Disabled") { + Hyper-V\Set-VM -VM $VM -CheckpointType "Disabled" + } } catch { Write-ErrorMessage "Failed to create snapshot: ${PSItem}" exit 1