hello,
I want to disable the vmtools options "Synchronize at startup and resume" with powercli for a several machines (envirenment vsphere 7 U1) , I found this script in the net, the script turn without error but the option still enable ( I always find the checkbox activate in the vm settings on the web interface),
the is the script that i find :
$vmxTab = @{
'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'
'time.synchronize.tools.enable' = '0'
'time.synchronize.resume.host' = '0'
}
$vm = Get-VM -Name vcenter-colas-3538-1y.bpa.bouyguestelecom.fr
if($vm.PowerState -eq 'PoweredOn'){
Shutdown-VMGuest -VM $vm -Confirm:$false
}
while($vm.PowerState -eq 'PoweredOn'){
sleep 30
$vm = Get-VM -Name vcenter-colas-3538-1y.bpa.bouyguestelecom.fr
}
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmxTab.GetEnumerator() | %{
$line = New-Object VMware.Vim.optionvalue
$line.Key = $_.Name
$line.Value= $_.Value
$spec.extraconfig += $line
}
$vm.ExtensionData.ReconfigVM($spec)
Moderator edit by wila: Moved post from vCenter Server discussions to PowerCLI discussions