3 easy ways to find out when Windows was last booted

You've come to the right place if you want to learn about the different ways to check the last boot time of a Windows computer.

Network administrators use Windows' last boot time as a metric to troubleshoot day-to-day issues that may occur on a system.

Let's start by looking at a few different methods for determining when Windows was last booted.

Force shell

There are several ways to use Power Shell to check your Windows computer's uptime or last boot time.

Get-CimInstance cmdlet

The Get-CimInstance cmdlet in PowerShell can be used to get the most recent system boot time.

The Get-CimInstance cmdlet (Instances of WMI classs) gets system information from the win32 operating system class name and passes it to the second instruction via a pipeline statement. It obtains the CIM (Common Information Model) class from the CIM server.

The second command fetches the CSName and lastBootupTime properties from the CIM and as a result displays the last boot time of the Windows machine.

First, open PowerShell and run it as an administrator.

Just enter the following command in PowerShell to view the last boot time.

Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime

Sample output:

PS C:Userstoadmin.ru> Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptimecsname          lastbootuptime------          --------------LAPTOP-9A5G7BR4 2/20/2022 1:26:40 PM

The gcim command below displays the Windows system uptime as a list with days, hours, and minutes. Instead of last boot time, it simply shows the system uptime since the last boot.

(get-date) - (gcim Win32_OperatingSystem).LastBootUpTime

Here gcim means Get-CimInstance.

Sample output:

PS C:Userstoadmin.ru> (get-date) - (gcim Win32_OperatingSystem).LastBootUpTimeDays              : 7Hours             : 8Minutes           : 44Seconds           : 38Milliseconds      : 884Ticks             : 6362788845605TotalDays         : 7.36433894167245TotalHours        : 176.744134600139TotalMinutes      : 10604.6480760083TotalSeconds      : 636278.8845605TotalMilliseconds : 636278884.5605

If you are using PowerShell 6 or higher, you can easily get Windows uptime and last boot time with the following command:

Get-Uptime -Since

To see all properties and methods of Get-CimInstance, use the following command.

Get-CimInstance Win32_OperatingSystem | Get-Member

This command provides information about all Get-CimInstance methods and their properties.

Get-WmiObject

You can easily query your PC's last boot time using the Get-WmiObject PowerShell command as shown below.

(Get-WmiObject Win32_OperatingSystem).LastBootUpTime

Sample output:

PS C:Userstoadmin.ru> (Get-WmiObject Win32_OperatingSystem).LastBootUpTime20220220132640.500000+330

You will see a result that may seem clumsy at first, but is not difficult to read and understand. You can easily determine the last boot time of your Windows computer.

The information below can be used to break down LastBootUpTime to 20220220132640.500000+330.

  • Year: 2022.
  • Month: 02.
  • Day: 20.
  • Time: 13.
  • Minutes: 26.
  • Seconds: 40.
  • Milliseconds: 500000.
  • GMT: +330 (5 and a half hours earlier than GMT).

Or you can also use another Get-WmiObject command to query the system's last boot time.

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

Lastbootuptime will be converted to a large integer format, which will eventually be displayed in a human-readable format.

Sample output:

PS C:Userstoadmin.ru> Get-WmiObject win32_operatingsystem | select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}csname          LastBootUpTime------          --------------LAPTOP-9A5G7BR4 2/20/2022 1:26:40 PM

Network Statistics Workstation

The netstatistics command displays system statistics, such as the number of bytes received and the total uptime since the computer was last booted.

net statistics workstation | select-string "Statistics"

You can also use the following shortcut:

net stats work | select-string "Stat"

Sample output:

PS C:Userstoadmin.ru> net statistics workstation | select-string "Statistics"Workstation Statistics for LAPTOP-9A5G7BR4Statistics since 2/20/2022 1:28:32 PM

System Information

You can use the systeminfo utility command to get the latest computer boot time information by downloading and parsing processor, patch, and Hyper-V information.

systeminfo

This command displays the hostname, OS version, build type, configuration, BIOS version, boot time, software installation date and all the details.

Of all this data, if you want to see only the specific data you need, you need to pass the Select -line additional utility to the systeminfo command.

Just enter the following command in the PowerShell terminal to see the last boot time.

systeminfo | Select-String "OS version","System Boot Time"

Here, the Select-String cmdlet looks for text patterns in input strings and files using regular expression matching.

The above command retrieves the last reboot time of the local computer and prints the system OS version and Windows system last boot time to the terminal as shown below.

Sample output:

PS C:Userstoadmin.ru> systeminfo | Select-String "OS version","System Boot Time"OS Version:                10.0.22000 N/A Build 22000System Boot Time:          2/20/2022, 1:26:40 PMBIOS Version:              Insyde F.18, 3/15/2019

Command line

You can also use the command line to check the uptime or last boot time of your Windows system with some commands and utilities such as net stats, wmic, and systeminfo.

System Information

The systeminfo command displays general information about the Windows operating system and its configuration. It displays the last boot time of Windows. If you want uptime, you need to manually determine how much time has passed since the last boot.

Open a command prompt and enter the following command.

systeminfo | find "System Boot Time"

Sample output:

C:Userstoadmin.ru>systeminfo | find "System Boot Time"System Boot Time: 2/20/2022, 1:26:40 PM

VMIC

The WMIC (Windows Management Instrumentation Command Prompt) command will give you a string representation of the computer's last boot time. The result is formatted as a four-digit year with two digits for the month, day, hour, minute, and second.

Open a command prompt and enter the following command.

wmic path Win32_OperatingSystem get LastBootUpTime

Sample output:

C:Userstoadmin.ru>wmic path Win32_OperatingSystem get LastBootUpTimeLastBootUpTime20220220132640.500000+330

This output can be read as 2022, month 2, day 20, hour 13 (or 13:00), minute 26, and so on.

Net statistics

The netstatistics command displays system statistics such as data bytes received, data bytes transmitted, number of connections made, and total uptime since the computer was last booted.

To see the services running on a Windows machine, use the following command.

net stats

This command simply displays the available running services on the system.

We can get statistics for a server or workstation using the NET STATISTICS context with the following command.

net stats workstation

Here I have provided a workstation to view statistics.

Sample output:

C:Userstoadmin.ru>net stats workstationWorkstation Statistics for LAPTOP-9A5G7BR4Statistics since 2/20/2022 1:28:32 PM  Bytes received                               66780  Server Message Blocks (SMBs) received        18  Bytes transmitted                            63746  Server Message Blocks (SMBs) transmitted     0  Read operations                              0  Write operations                             0  Raw reads denied                             0  Raw writes denied                            0  Network errors                               0  Connections made                             0  Reconnections made                           0  Server disconnects                           0  Sessions started                             0  Hung sessions                                0  Failed sessions                              0  Failed operations                            0  Use count                                    10  Failed use count                             0The command completed successfully.

This command can be used from a batch file, and the output can be filtered using the "find" command. For example, if you only want to find the last boot time of the system, use the following command.

net statistics workstat

Sample output:

C:Userstoadmin.ru>net statistics workstation | find "Statistics"Workstation Statistics for LAPTOP-9A5G7BR4Statistics since 2/20/2022 1:28:32 PM

And if you want to know the Windows Server uptime, the command will become a network statistics server.

Task manager

This is the easiest way to check if your device is working. Instead of showing the last boot time, it shows the system uptime since the last boot.

  • To open Task Manager, simply use the keyboard shortcut Ctrl + Shift + Esc.
  • Click the Performance tab.
  • The system uptime will be displayed at the bottom of the window.

This means that the system has been rebooted up to 8 days, 8 hours and 29 minutes.

Output

Here are some of the ways to quickly get the latest information about boot time or Windows system uptime.

Each team has its own set of advantages. You can choose the method that best suits your needs.

I hope you found this article very helpful in learning how to get the last boot time of a Windows system in various ways.

You may also be interested in learning about the best tools for monitoring Windows servers.

Related posts