How To Get The Last Boot Time In Windows

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.

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

Resource: How to Tell if PowerShell is Installed

powershell

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.

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

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

command_prompt

Command Prompt – systeminfo

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

bootime05
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.

Resource: Working with Dates and Times using WMI

 

bootime04
wmic os get lastbootuptime

Scott Bollinger / kfalconspb / www.bollingerusa.com

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s