Saturday, July 13, 2013

Configuring NTP for all host connected to vCenter Server !

Connect to vCenter server from powerCLI using the command

connect-viserver  "vcenter server name/ip"
then give username and password once prompted.

$allhost = get-vmhost
Add-VmHostNtpServer -NtpServer "ntp server 1" -VMHost $allhost
Add-VmHostNtpServer -NtpServer "ntp server 2" -VMHost $allhost
$ntp = Get-VMHostService -VMHost $allhost | Where {$_.Key -eq "ntpd"}
Set-VMHostService -HostService $ntp -Policy "Automatic"
Restart-VMHostService $ntp -Confirm:$fase

No comments: