Get lastboouptime in EST time zone.

This topic contains 3 replies, has 3 voices, and was last updated by  Kishor Suvarna 11 months ago.

  • Author
    Posts
  • #54431

    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

    Don Jones
    Keymaster

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

  • #54434

    Daniel Krebs
    Moderator

    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

    Kishor Suvarna
    Participant

    Thank you Dan it works!

You must be logged in to reply to this topic.