Get lastboouptime in EST time zone.

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of Kishor Suvarna Kishor Suvarna 5 days, 20 hours ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #54431
    Profile photo of Kishor Suvarna
    Kishor Suvarna
    Participant

    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.

    #54433
    Profile photo of Don Jones
    Don Jones
    Keymaster

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

    #54434
    Profile photo of Daniel Krebs
    Daniel Krebs
    Participant

    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)
    
    #54437
    Profile photo of Kishor Suvarna
    Kishor Suvarna
    Participant

    Thank you Dan it works!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.