Thursday, August 4, 2016

View NTP UTC times for all ESX host and use set "UTC" setting and sync with local machine

Check ESX times 
Get-VMHost | sort Name | select Name,@{Name="Current VMHost Time";Expression={(Get-View $_.ExtensionData.ConfigManager.DateTimeSystem).QueryDateTime()}}


Set ESX times

#Set Time for ESX Host
$hosts =get-vmhost
foreach($i in $hosts){
$t = Get-Date
$dst = Get-VMHost $i | %{ Get-View $_.ExtensionData.ConfigManager.DateTimeSystem }
$dst.UpdateDateTime((Get-Date($t.ToUniversalTime()) -format u))
}



Check hardcoated machines

get-view -viewtype virtualmachine -Filter @{'Config.Tools.SyncTimeWithHost'='True'} | select name



After this you will receive a list with VM name that have their vm tools time sync enabled.
One more thing that is worth reading while thinking about virtual machine tools time synchronization is this:
Disabling Time Synchronization (1189)

And some more information about troubleshooting esx/esxi host system regarding ntp.
Troubleshooting NTP on ESX and ESXi (1005092)
If you would like to change policy for vm tools time sync you can see how i was changing the vmware tools upgrade policy http://wp.me/pAXaY-73 and just change 1 line in the code:
from:$spec.tools.toolsUpgradePolicy = “upgradeAtPowerCycle”
to:$spec.tools.syncTimeWithHost = $true // or $false
And this will do the trick.

No comments:

Post a Comment

Vmware NSX SSL creation 

Using OpenSSL for NSX Manager SSL import: Creates CSR and 4096 bit KEY Creating NSX 6.4.2 SSL    openssl req -out nsxcert.csr -newkey rsa:40...