$Cluster = "<cluster name>"
$Hosts = Get-Cluster $Cluster | Get-VMHost
ForEach ($Host in $Hosts)
{
Remove-VmHostNtpServer -NtpServer "x.x.x.x" -VMHost $Host | Out-Null
Remove-VmHostNtpServer -NtpServer "x.x.x.x" -VMHost $Host | Out-Null
Add-VmHostNtpServer -NtpServer "ntp0.sysxperts.com" -VMHost $Host | Out-Null
Add-VmHostNtpServer -NtpServer "ntp1.sysxperts.com" -VMHost $Host | Out-Null
Get-VMHostService -VMHost $Host | Where-Object {$_.key -eq "ntpd"} | Restart-VMHostService Confirm:$false | Out-Null
write "NTP Server was changed on $host"
}
No comments:
Post a Comment