Author Posts

September 22, 2016 at 2:26 pm

Hi,
When I use Get-CimInstance to get lastbootuptime for a server I get the output in my laptop time zone, but I need it in EST, please help.

September 22, 2016 at 2:28 pm

You're also going to have to query the laptop's time zone and do the conversion math.

September 22, 2016 at 2:35 pm

The following works on my machine:

$os = Get-CimInstance -ClassName Win32_OperatingSystem -Property LastBootUpTime

$timeZoneInfo = [System.TimeZoneInfo]::FindSystemTimeZoneById('Eastern Standard Time')
[System.TimeZoneInfo]::ConvertTimeFromUtc($os.LastBootUpTime.ToUniversalTime(), $timeZoneInfo)

September 22, 2016 at 3:03 pm

Thank you Dan it works!