From 88469d99f70379ad10e1677650fd366e67365533 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Thu, 4 Oct 2018 15:24:05 -0700 Subject: [PATCH] Only configure CheckpointType if available to be configured. --- plugins/providers/hyperv/scripts/configure_vm.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/providers/hyperv/scripts/configure_vm.ps1 b/plugins/providers/hyperv/scripts/configure_vm.ps1 index 023993270..39aa7325e 100644 --- a/plugins/providers/hyperv/scripts/configure_vm.ps1 +++ b/plugins/providers/hyperv/scripts/configure_vm.ps1 @@ -91,7 +91,14 @@ if($EnableCheckpoints) { } try { - Hyper-V\Set-VM -VM $VM -CheckpointType $checkpoints + if((Get-Command Hyper-V\Set-VM).Parameters["CheckpointType"] -eq $null) { + if($CheckpointAction -eq "enable") { + Write-ErrorMessage "CheckpointType is not available. Cannot enable checkpoints." + exit 1 + } + } else { + Hyper-V\Set-VM -VM $VM -CheckpointType $checkpoints + } } catch { Write-ErrorMessage "Failed to ${CheckpointAction} checkpoints on VM: ${PSItem}" exit 1