參考資料
Setting ESXi DNS and NTP using PowerCLI
$esxHosts = get-VMHost
foreach ($esx in $esxHosts) {
Write-Host "Configuring NTP Client Policy on $esx" -ForegroundColor Green
Get-VMHostService -VMHost $esx | where{$_.Key -eq "ntpd"} | Set-VMHostService -policy "on" -Confirm:$false
Write-Host "Restarting NTP Client on $esx" -ForegroundColor Green
Get-VMHostService -VMHost $esx | where{$_.Key -eq "ntpd"} | Restart-VMHostService -Confirm:$false
}
$vmhosts = Get-VMHost
$details = @()
foreach ($vmhost in $vmhosts) {
$detail = "" | select Name,NTPServer
$detail.Name = $vmhost.Name
$detail.NTPServer = Get-VMHostNtpServer $vmhost
$details += $detail
}
$details
Facebook Comments Box