VMware Cloud Community
aideyuk
Contributor
Contributor
Jump to solution

I want to get the Times off all the ESXi Hosts so I can compare their times to the Local NTP

The idea was to have a powershell script that checks the time on the NTP, Times on all the ESX hosts and times on all the Window servers.

We can then see if there are any time slips happening by comparing the NTP and device times.

I have the powershell NTP and windows servers sorted.

When I look at the Time of an Esx from within the Virtual Centre the time displays correctly

When I use the Powercli command to get the time its around 1 hour behind.

So first thought is its British Summer Time ?

Get-EsxCli -VMHost {hostname}).System.Time.get()

The NTP Returns 08:37:59

The ESX Returns 07:38:00

So my check says hang on, its an hour out ?

I could add 60 Minutes but then it will fail when we change back to British Winter time ?

Any idea's on best way to approach this one ?

Cheers

Aidey

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The esxcli command indeed returns the time in UTC.

To convert to local time, you could do

$esxcli = Get-EsxCli -VMHost hostname

([DateTime]($esxcli.System.Time.get())).ToLocalTime()

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

The esxcli command indeed returns the time in UTC.

To convert to local time, you could do

$esxcli = Get-EsxCli -VMHost hostname

([DateTime]($esxcli.System.Time.get())).ToLocalTime()

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
aideyuk
Contributor
Contributor
Jump to solution

Many thanks LucD

That works perfect for what I want to do.

Cheers

Aidey

0 Kudos