Last Bootup Time with Get-CimInstance

by May 19, 2016

These days, computers hibernate or go into standby but do not really reboot that often anymore. To find out when your computer rebooted the last time, try this line in PowerShell 3.0 or better:

Get-CimInstance -Class Win32_OperatingSystem  |  
  Select-Object -ExpandProperty LastBootupTime

In older PowerShell versions, there is no Get-CimInstance, and you would have to resort to the simple Get-WmiObject cmdlet:

Get-WmiObject -Class Win32_OperatingSystem |  
  Select-Object -ExpandProperty LastBootupTime

One of the disadvantages of Get-WmiObject is that it does not return DateTime objects but instead its own WMI date and time format:

 
20160420070403.496011+120
 

Twitter This Tip! ReTweet this Tip!