Script
-------------------------------------------------------------------------------------------------
Add-PSSnapin vmWARE.VimAutomation.Core
$vc = Connect-VIServer vCentername
$cluster = "test"
$esx = Get-cluster "test" | Get-VMHost
#Configure NTP server
Add-VmHostNtpServer -VMHost $esx -NtpServer 172.140.124.41
Add-VmHostNtpServer -VMHost $esx -NtpServer 172.140.124.51
#Allow NTP queries outbound through the firewall
Get-VMHostFirewallException -VMHost $esx | where {$_.Name -eq "NTP client"} | Set-VMHostFirewallException -Enabled:$true
#Start NTP client service and set to automatic
Get-VmHostService -VMHost $esx | Where-Object {$_.key -eq "ntpd"} | Start-VMHostService
Get-VmHostService -VMHost $esx | Where-Object {$_.key -eq "ntpd"} | Set-VMHostService -policy "automatic"
附件:http://down.51cto.com/data/2366944
本文转自学海无涯博客51CTO博客,原文链接http://blog.51cto.com/549687/1958983如需转载请自行联系原作者
520feng2007