Get lastboouptime in EST time zone.

Welcome Forums General PowerShell Q&A Get lastboouptime in EST time zone.

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
2 years, 1 month ago.

  • Author
    Posts
  • #54431

    Participant
    Points: 0
    Rank: Member

    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

    Keymaster
    Points: 1,619
    Helping HandTeam Member
    Rank: Community Hero

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

  • #54434

    Moderator
    Points: 24
    Team Member
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    Thank you Dan it works!

The topic ‘Get lastboouptime in EST time zone.’ is closed to new replies.