Configure NTP (The lazy way)

      No Comments on Configure NTP (The lazy way)

NTP, such an important and sometimes forgotten service.
Other services rely on it heavily, eg. SSO, yet it can be quite cumbersome to configure if you do it host by host (appliances like VC and PSC also require it)

Using PowerCLI this change can be done in seconds!

Add-VmHostNtpServer -VMHost (Get-VMHost) -NtpServer "Timeserver FQDN"
Add-VmHostNtpServer -VMHost (Get-VMHost) -NtpServer "x.x.x.x"
Get-VMHost | Get-VMHostFirewallException | where {$_.Name -eq "NTP client"} | Set-VMHostFirewallException -Enabled:$true
Get-VMHost | Get-VmHostService | Where-Object {$_.key -eq "ntpd"} | Start-VMHostService
Get-VMhost | Get-VmHostService | Where-Object {$_.key -eq "ntpd"} | Set-VMHostService -policy "automatic"

In short, I’m adding a timeserver hostname and an ip address. This second one is optional but I like to do it anyway in case DNS fails. Other services will likely fail as well, but old habits die hard! 🙂
Then I’m enabling NTP client on the host and making sure it starts with the host at reboot

Leave a Reply

Your email address will not be published. Required fields are marked *