#To get time and ntp info for  all esxi : Get-VMHost | Sort Name | Select Name, @{N="NTPServer";E={$_ |Get-VMHostNtpServer}}, Timezone, @{N="CurrentTime";E={(Get-View $_.ExtensionData.ConfigManager.DateTimeSystem) | Foreach {$_.QueryDateTime().ToLocalTime()}}}, @{N="ServiceRunning";E={(Get-VmHostService -VMHost $_ |Where-Object {$_.key-eq "ntpd"}).Running}} ` | Format-Table -AutoSize or Get-VMHost | Get-VMHostService | Where-Object {$_.key -eq "ntpd"} | select vmhost, label, Key, Policy, Running, Required |format-table -autosize # Remove wrong NTP Server and Add correct NTP server Get-VMHost | Remove-VMHostNtpServer -NtpServer ntp.mn Confirm:$false Get-VMHost | Add-VMHostNtpServer -NtpServer 0.asia.pool.ntp.org # Start NTP Service and set to Automatic Get-VMHost |  <span><a href="https://www.itforce.mn/index.php/2019/01/31/how-to-check-that-ntp-server-is-configured-properly-for-all-esxi/" class="readmore">Continue reading &rarr;</a></span>{"id":1414,"date":"2019-01-31T20:50:48","date_gmt":"2019-01-31T12:50:48","guid":{"rendered":"https:\/\/www.itforce.mn\/?p=1414"},"modified":"2019-01-31T22:26:27","modified_gmt":"2019-01-31T14:26:27","slug":"how-to-check-that-ntp-server-is-configured-properly-for-all-esxi","status":"publish","type":"post","link":"https:\/\/www.itforce.mn\/index.php\/2019\/01\/31\/how-to-check-that-ntp-server-is-configured-properly-for-all-esxi\/","title":{"rendered":"How to check that ntp server is configured properly for all esxi"},"content":{"rendered":"<p>#To get time and ntp info for\u00a0 all esxi :<\/p>\n<pre>Get-VMHost | Sort Name | Select Name,  @{N=\"NTPServer\";E={$_ |Get-VMHostNtpServer}},   Timezone,  @{N=\"CurrentTime\";E={(Get-View $_.ExtensionData.ConfigManager.DateTimeSystem) | Foreach {$_.QueryDateTime().ToLocalTime()}}},  @{N=\"ServiceRunning\";E={(Get-VmHostService -VMHost $_ |Where-Object {$_.key-eq \"ntpd\"}).Running}} ` | Format-Table -AutoSize\r\n\r\nor \r\n\r\nGet-VMHost | Get-VMHostService | Where-Object {$_.key -eq \"ntpd\"} | select vmhost, label, Key, Policy, Running, Required |format-table -autosize\r\n\r\n<\/pre>\n<p># Remove wrong NTP Server and Add correct NTP server<\/p>\n<pre>Get-VMHost | Remove-VMHostNtpServer -NtpServer ntp.mn Confirm:$false\r\nGet-VMHost | Add-VMHostNtpServer -NtpServer 0.asia.pool.ntp.org\r\n<\/pre>\n<p># Start NTP Service and set to Automatic<\/p>\n<pre>Get-VMHost | Get-VMHostService | Where-Object {$_.key -eq \"ntpd\" } | Start-VMHostService\r\nGet-VMHost | Get-VMHostService | Where-Object {$_.key -eq \"ntpd\" } | Set-VMHostService -policy \"automatic\"\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":null,"protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-1414","post","type-post","status-publish","format-standard","hentry","category-powercli"],"_links":{"self":[{"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/posts\/1414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/comments?post=1414"}],"version-history":[{"count":10,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/posts\/1414\/revisions"}],"predecessor-version":[{"id":1424,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/posts\/1414\/revisions\/1424"}],"wp:attachment":[{"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/media?parent=1414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/categories?post=1414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itforce.mn\/index.php\/wp-json\/wp\/v2\/tags?post=1414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}