Only configure CheckpointType if available to be configured.

This commit is contained in:
Chris Roberts 2018-10-04 15:24:05 -07:00
parent a4231d630a
commit 88469d99f7
1 changed files with 8 additions and 1 deletions

View File

@ -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