I have a powercli script that modifies vmx files, then reloads the vmx file. Is a VM poweroff and poweron still required for the new values in the vmx file to be applied to the VM?
Script:
#disable-vmtimesync.ps1
$ExtraOptions = @{
"tools.syncTime"="0";
"time.synchronize.continue"="0";
"time.synchronize.restore"="0";
"time.synchronize.resume.disk"="0";
"time.synchronize.shrink"="0";
"time.synchronize.tools.startup"="0";
}
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
# note we have to call the GetEnumerator before we can iterate through
Foreach ($Option in $ExtraOptions.GetEnumerator()) {
$OptionValue = New-Object VMware.Vim.optionvalue
$OptionValue.Key = $Option.Key
$OptionValue.Value = $Option.Value
$vmConfigSpec.extraconfig += $OptionValue
}
# Get all vm's not including templates
$VMs = Get-View -ViewType VirtualMachine -Property Name -Filter @{"Config.Template"="false"} | ? { $_.name -eq "CTX82" }
foreach($vm in $vms){
$vm.ReconfigVM_Task($vmConfigSpec)
$vm.reload()
}