Virtualization, Cloud, Infrastructure and all that stuff in-between
My ramblings on the stuff that holds it all together
POSH1Liner: Set NTP server on all hosts attached to a vCenter
February 13, 2018
Posted by on Connect-VIServer L2-mgt-vcsa01.theborg.int
Get-VMHost | Add-VMHostNtpServer -ntpserver “pool.ntp.org”
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”
Original script from this blog post Modified to add -ntpserver parameter and public NTP server name incase you don’t have your own