8 Comments

  1. Kevin

    It’s endlessly fascinating to me that Windows doesn’t maintain this as something more easily attained than scraping through an eventlog. And to have to write a script to dig through and find it. Unix has had this right forever……”uptime”

    • Aman Dhally

      Hi

      You can use this [Management.ManagementDateTimeConverter]::ToDateTime((gwmi win32_operatingsystem).LastBootupTime)
      to get a uptime quickly.

      But if you need a history of system time, then the Event log are the only way.

      t
      aman

  2. Prakash Jha

    An alternate way could be, Get-CIMInstance -ClassName Win32_OperatingSystem | Select-Object -Property LastBootUptime
    Thanks for the info about Event Logs.

    • Aman Dhally

      Thanks Prakash,

      Yes you can do that, but this will give up boot time of the current session/login.

      What if , if you was a boot time history of last 10 days or 30 days, you can them only by Event logs 🙂

      t
      aman

Leave a Reply

Your email address will not be published. Required fields are marked *