Merge pull request #10264 from chrisroberts/f-win-autochk
Wrap automatic checkpoint enable to prevent inadvertent execution
This commit is contained in:
commit
7241bd9fda
|
@ -106,12 +106,14 @@ if($EnableAutomaticCheckpoints) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if($autochecks -eq 1 -and (Get-Command Hyper-V\Set-VM).Parameters["AutomaticCheckpointsEnabled"] -eq $null) {
|
if((Get-Command Hyper-V\Set-VM).Parameters["AutomaticCheckpointsEnabled"] -eq $null) {
|
||||||
|
if($autochecks -eq 1) {
|
||||||
Write-ErrorMessage "AutomaticCheckpointsEnabled is not available"
|
Write-ErrorMessage "AutomaticCheckpointsEnabled is not available"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
Hyper-V\Set-VM -VM $VM -AutomaticCheckpointsEnabled $autochecks
|
Hyper-V\Set-VM -VM $VM -AutomaticCheckpointsEnabled $autochecks
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
Write-ErrorMessage "Failed to ${AutoAction} automatic checkpoints on VM: ${PSItem}"
|
Write-ErrorMessage "Failed to ${AutoAction} automatic checkpoints on VM: ${PSItem}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in New Issue