How To Get The Last Boot Time In Windows

Checking when last booted

Posted by Scott Bollinger/@kfalconspb on March 09, 2016 #GeneralIT

Boot Time done four ways

There's usually more than one way to do things in IT and getting the last boot time in Windows is no different.  Depending on OS Version, version of Powershell if installed, or if wmic is installed, will dictate the command to be used.

Resource: How to Tell if PowerShell is Installed

Below are four ways to get the last boot time on Windows. Two are via PowerShell and two via the Command Prompt.

Powershell command - current

The first Powershell command is for Powershell version 3.

Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime

Powershell command - legacy

This second command is for Powershell versions 1 and 2.

Get-WmiObject win32_operatingsystem | select csname, @{LABEL=’LastBootUpTime’;EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}

Command Prompt - systeminfo

The third command is for Windows 7 or later command prompt.

systeminfo | find /i "Boot Time"

Command Prompt - wmic

The final command is a wmic command.

This wmic command is the same that is called in the second Powershell above but is called natively at the command prompt.

Wmic returns time in UTC.

wmic os get lastbootuptime

Scott Bollinger / @kfalconspb

Resource: https://blogs.technet.microsoft.com/heyscriptingguy/2013/03/27/powertip-get-the-last-boot-time-with-powershell/

Resource: Working with Dates and Times using WMI