Skip to content

NTP check with Powercli


Oneliners to speed up troubleshooting common NTP related issues. 

Connect-ViServer <vCenter address> -user administrator@vsphere.local -password VMware123!

Check NTP Server is configured.

Get-VMHost |Sort Name|Select Name, @{N=“NTPServer“;E={$_ |Get-VMHostNtpServer}}, @{N=“ServiceRunning“;E={(Get-VmHostService -VMHost $_ |Where-Object {$_.key-eq “ntpd“}).Running}}

Check timestamp for ESXi host.

foreach($esxcli in get-vmhost|get-esxcli){“”|select @{n=’Time’;e={$esxcli.system.time.get()}},@{n=’hostname’;e={$esxcli.system.hostname.get().hostname}} }

Set time manually on esxi host. 

Directly on host: esxcli system time set -H 03 -m 29 -s 40

H =Hour

m = minute

s = mecond

$esxlist = get-vmhost

foreach ($_ in $esxlist) {$esxcli = Get-EsxCli -VMHost $_; $esxcli.system.time.get();}


Set time via powercli


owerCLI C:\TEMPP> $

et the system clock time. Any missing parameters will default to the current time

day | Day

hour | Hour

min | Minute

month | Month

sec | Second

year | Year




For all hosts.

$esxlist = get-vmhost

foreach ($_ in $esxlist) {$esxcli = Get-EsxCli -VMHost $_; $esxcli.system.time.get();}

foreach($_ in $esxlist){$esxcli = Get-EsxCli -VMHost $_; $esxcli.system.time.set(10,09,53,01,20,2019); }

/// Parameters are ///





2 thoughts on “NTP check with Powercli Leave a comment

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 )

Connecting to %s

%d bloggers like this: