Grabbing NTP server list from VMHosts in Vcenter

05 Apr

Due to some changes to our NTP server, I needed to review all the ESX hosts the region. This page nicely summarises all the cmdlet we can and should use:

Here is the one-liner which I used to grab NTP values off ESX servers (note: below is for readability, they should be in a single line). This will output a tab delimited file with ESX host name and a comma-delimited NTP server list.

$vc = “vcenter-01” ;

connect-viserver $vc -user VC_admin –password ##### ;

get-vmhost | % {$ + “`t” + ((get-vmhostntpserver $ -join “,”)

| out-file “c:\temp\$vc-ntp.txt” -append} ;

disconnect-viserver $vc -confirm:$false

Leave a comment

Posted by on April 5, 2013 in powershell, Scripts, vmware


Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: