VMware Cloud Community
godek26
Contributor
Contributor
Jump to solution

setting syncTimeWithHost does no longer work in vSphere 7.0.2

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

Labels (3)
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Yes, they are both needed since 7.0.1


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
13 Replies
LucD
Leadership
Leadership
Jump to solution

Since 7.0.1 the property syncTimeWithHostAllowed has to be set to $true for syncTimeWithHost to work.

time.png


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
godek26
Contributor
Contributor
Jump to solution

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

Reply
0 Kudos
godek26
Contributor
Contributor
Jump to solution

Or do I simply (now) have to set both properties?

 

br

Chris

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Yes, they are both needed since 7.0.1


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
godek26
Contributor
Contributor
Jump to solution

Indeed,

setting both properties works

 

godek26_0-1637326181063.png

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

Reply
0 Kudos
lm1985
Contributor
Contributor
Jump to solution

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

 

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

godek26
Contributor
Contributor
Jump to solution

The last version is working beautifully!

Many thanks Luc!

 

br

Chris

Reply
0 Kudos
lm1985
Contributor
Contributor
Jump to solution

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!

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Which version are you using?
Do a

Get-Module -Name VMware* -ListAvailable


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

lm1985
Contributor
Contributor
Jump to solution

PowerCLI Version is 11.5.0 build 14912921

and PowerShell 5.1.14409 I tried also with powershell 7.2.2 and same result

Thanks & Regards!

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Tags (1)
lm1985
Contributor
Contributor
Jump to solution

Thanks you very much @LucD you rocks

I have tried with powercli 12.5 and it is perfectly working

Much appreciated

Regards!

Reply
0 Kudos