Thanks to the VMware VI Toolkit 1.5, checking the NTP settings on all your VMware ESX Servers is as easy as a oneliner:

Get-VMHost | Sort Name | Select Name, @{N=”NTP”;E={Get-VMHostNtpServer $_}}

Tagged with:
 

3 Responses to Checking VMware NTP configuration with Powershell

  1. Henk says:

    If only there was a Set-VMHostNtpServer….
    Keep up the goods!

  2. Josh A says:

    I recently needed to check settings as well as determine if the NTPD service was running.

    Get-VMHost | Select-Object Name,@{Name=”NTPServer”;Expression={$_ | Get-VMHostNtpServer}}, @{Name=”NTPRunning”;Expression={($_ | Get-VMHostService | Where-Object {$_.key -eq “ntpd”}).Running}} | Sort-Object -Property “NTPRunning”, “NTPServer”

    I used this to generate a report and added some extra script to fix incorrect settings (also works to change NTP server setting) as well as restart NTPD service if it has stopped.

    I have the full script available at:
    http://day2dayadmin.blogspot.com/2009/10/ntp-powershell-its-about-time.html

    and on the PowerCLI VMware community.

Leave a Reply