Disabling automatic checkpoints

Signed-off-by: Patrick Lang <plang@microsoft.com>
This commit is contained in:
Patrick Lang 2017-09-21 14:51:38 -07:00
parent 4ce381cae7
commit 6acdb9d148
1 changed files with 17 additions and 0 deletions

View File

@ -213,10 +213,27 @@ New-VM -Name $vmName -Path $path -MemoryStartupBytes $memoryStartupBytes -NewVHD
return err
}
err = DisableAutomaticCheckpoints(vmName)
if err != nil {
return err
}
return DeleteAllDvdDrives(vmName)
}
}
func DisableAutomaticCheckpoints(vmName string) error {
var script = `
param([string]$vmName)
if ((Get-Command Set-Vm).Parameters["AutomaticCheckpointsEnabled"]) {
Set-Vm -Name $vmName -AutomaticCheckpointsEnabled $false }
`
var ps powershell.PowerShellCmd
err := ps.Run(script, vmName)
return err
}
func SetVirtualMachineCpuCount(vmName string, cpu uint) error {
var script = `