mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-28 04:36:05 -04:00
Check for automatic checkpoint support before configuring
The AutomaticCheckpointsEnabled option may not always be available depending on the version in use. Check for support before applying the configured value. If automatic checkpoints are to be enabled and support is not available, force an error.
This commit is contained in:
parent
7a7ae59704
commit
1f74aedeaa
1 changed files with 5 additions and 0 deletions
|
|
@ -106,6 +106,11 @@ if($EnableAutomaticCheckpoints) {
|
|||
}
|
||||
|
||||
try {
|
||||
if($autochecks -eq 1 -and (Get-Command Hyper-V\Set-VM).Parameters["AutomaticCheckpointsEnabled"] -eq $null) {
|
||||
Write-ErrorMessage "AutomaticCheckpointsEnabled is not available"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Hyper-V\Set-VM -VM $VM -AutomaticCheckpointsEnabled $autochecks
|
||||
} catch {
|
||||
Write-ErrorMessage "Failed to ${AutoAction} automatic checkpoints on VM: ${PSItem}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue