Set_NTP on ESXi Hosts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | CLS #Connect to vCenter or individual ESXi Host Connect-VIServer {vCenter FQDN} -User {Username} -Password {Password} #Get Hosts connected to vCenter and add the NTP server Get-VMHost | Add-VMHostNtpServer {FQDN of NTP server 1} Get-VMHost | Add-VMHostNtpServer {FQDN of NTP server 2} #Allow the ESXi Host to allow connectivity to NTP through the firewall Get-VMHost | Get-VMHostFirewallException | where {$_.Name -eq "NTP client"} | Set VMHostFirewallException -Enabled:$true #Start the NTPd service on the ESXi Host and set the service to automatic Get-VMHost | Get-VmHostService | Where-Object {$_.key -eq "ntpd"} | Start-VMHostService Get-VMhost | Get-VmHostService | Where-Object {$_.key -eq "ntpd"} | Set-VMHostService -policy "automatic" #Disconnect from vCenter Disconnect-VIServer * -Force -Confirm:$false |