We have been using this method to configure timesync on or off for some time.
Today I have noticed that this does no longer work.
The reconfigure task is created, there is no error, but the web UI does not show the setting to be modified.
Has something changed or do I overlook something?
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec $spec.tools = New-Object VMWare.Vim.ToolsConfigInfo $spec.tools.syncTimeWithHost = $false Get-VM | where{$_.ExtensionData.Config.Tools.syncTimeWithHost} | ForEach-Object -Process { $_.ExtensionData.ReconfigVM($spec) }
br
Chris
Yes, they are both needed since 7.0.1
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Since 7.0.1 the property syncTimeWithHostAllowed has to be set to $true for syncTimeWithHost to work.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc for the swift reply,
No matter if I set to true or false the setting reflected in the webinterface does not longer change.
Do you have any idea how I can find out the actual setting? Or a simple test if the setting true works?
br
Chris
Or do I simply (now) have to set both properties?
br
Chris
Yes, they are both needed since 7.0.1
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Indeed,
setting both properties works
Are better readable example for other who may look for it later
$vm= Get-VM $VMint
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.changeVersion = $vm.ExtensionData.Config.ChangeVersion
$spec.tools = New-Object VMware.Vim.ToolsConfigInfo
$spec.tools.syncTimeWithHost = $true
$spec.tools.syncTimeWithHostAllowed = $true
$_this = Get-View -Id $vm.Id
$_this.ReconfigVM_Task($spec)
Many thanks for pointing me in the right direction.
br
Chris
Hello Im trying to change the setting
"syncTimeWithHostAllowed"
but I dont have good luck with that
In your example what exactly means $_this
thanks and regards
Try with this (without $_this) 😁
$vm = Get-VM -Name 'MyVM'
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.changeVersion = $vm.ExtensionData.Config.ChangeVersion
$spec.tools = New-Object VMware.Vim.ToolsConfigInfo
$spec.tools.syncTimeWithHost = $true
$spec.tools.syncTimeWithHostAllowed = $true
$vm.ExtensionData.ReconfigVM($spec)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The last version is working beautifully!
Many thanks Luc!
br
Chris
Hi guys thank you so much for your help
Any special version for powershell/powercli for this script, Im trying since few days ago but for some reason getting the error
The property 'syncTimeWithHostAllowed' cannot be found on this object
Verify that the property exists exists and can be set
Thanks & Regards!
Which version are you using?
Do a
Get-Module -Name VMware* -ListAvailable
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
We are currently on 12.5.
Try to upgrade first
Update-Module -Name VMware.PowerCLI -Force -Confirm:$false
When you get certificate errors during the install, first remove all existing PowerCLI modules by deleting the folders
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks you very much @LucD you rocks
I have tried with powercli 12.5 and it is perfectly working
Much appreciated
Regards!