Archive for December, 2017

Powercli script to get host NTP settings

Below one liner will get Hostname, NTP server details and NTP service running status for all the Esxi Hosts in a vcenter.  I tested this on vcenter running 5.5 version.

You need to run the below one liner in Powercli and the output will be exported into c:\scripts folder.

Get-VMHost |Sort Name|Select Name, @{N=”NTPServer”;E={$_ |Get-VMHostNtpServer}}, @{N=”ServiceRunning”;E={(Get-VmHostService -VMHost $_ |Where-Object {$_.key-eq “ntpd”}).Running}} | export-csv c:\Scripts\ntp.csv

Output will be like…

Name NTPServer ServiceRunning
Esxi1.test.local time.test.com TRUE
Esxi2.test.local time.test.com TRUE

 

2 Comments