PeetersOnline.nl
Checking VMware NTP configuration with Powershell
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 $_}}
3 Responses to Checking VMware NTP configuration with Powershell
Leave a Reply Cancel reply
Tags
Active Directory API bind order cleanup cluster CPU Custom Fields datastores description device management directory tree errors Event Log file name filter Fun function HA IT known issues License Server LUN multipath NIC objects Oneliner portgroups PowerCLI PowerShell profile recursive Registry Scripts security session share snapshots SQL Stat VI Toolkit VMware vSphere WMI WSUS ZenRecent Comments
- Ben @ Geekswing on Helpful script of the day: HA calculations
- Jo Lambrecht on WSUS Cleanup with Powershell
- Luke on Powershell Open File Dialog Box
- Umapathi on WSUS Cleanup with Powershell
- Yomodo on User Confirmation in Powershell
Archives
- July 2012
- July 2011
- February 2011
- January 2011
- December 2010
- May 2010
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008





If only there was a Set-VMHostNtpServer….
Keep up the goods!
Whoops add-VMHostNtpServer is there to the rescue!
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.