PowerTip: Use PowerShell to Display Last Boot Time

PowerTip: Use PowerShell to Display Last Boot Time

  • Comments 7
  • Likes

Summary: Learn how to use Windows PowerShell to display last boot up time.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find the last time a workstation booted up?

Hey, Scripting Guy! Answer Use the WMI Class Win32_OperatingSystem and select the LastBootupTime property.
          Using the Get-CimInstance cmdlet returns a properly formatted DateTime object, for example:

(Get-CimInstance Win32_operatingSystem).lastbootuptime

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Hi, is it possible to confirm which versions of PowerShell this will work with?

  • The CIM cmdlets came out with PowerShell 3. For PowerShell 2, use Get-WmiObject

  • And, if you're going to use Get-WmiObject, please consider that it will not, by default, return a properly formatted datetime object. This example should help in that case: [Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject -Class Win32_OperatingSystem | Select-Object -Property LastBootupTime).LastBootupTime)

  • Hi Ed,
    just wrote a full blog post on the subject:
    Hope you find it interesting!

  • http://www.verboon.info/2014/01/powershell-retrieve-system-startup-time-information/
    I wrote this a while ago.

  • thank you

  • Get-CimInstance -ClassName Win32_OperatingSystem | select computername, lastbootuptime