Merge pull request #10265 from chrisroberts/f-win-chktyp

Only configure CheckpointType if available to be configured.
This commit is contained in:
Chris Roberts 2018-10-09 14:47:15 -07:00 committed by GitHub
commit 080dd748ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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