You’ve come to the right place if you want to learn about different ways to check the last boot time of the windows machine.
Network administrators use Windows last boot time as a metric to troubleshoot day-to-day issues that may arise in the system.
Let’s start by looking at a couple of different methods to identify the Windows last boot time.
Power Shell
There are some ways to utilize Power Shell to check your Windows machine’s uptime or last boot time.
Get-CimInstance cmdlet
The Get-CimInstance cmdlet in PowerShell can be used to obtain the system’s most recent boot time.
Get-CimInstance cmdlet (instances of WMI classes) gets system information from the win32 operating system class name and provides it to the second instruction via the pipeline operator. It obtains a class’s CIM (Common Information Model ) instances from a CIM server.
The second command chooses the CSName and lastBootupTime properties from CIM and displays the windows machine’s last boot time as a result.
First, Open the PowerShell and run it as an administrator.
Just type the following command in the PowerShell to view the last boot time.
Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime
Sample Output:
PS C:\Users\geekflare> Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime
csname lastbootuptime
------ --------------
LAPTOP-9A5G7BR4 2/20/2022 1:26:40 PM
The below gcim
command displays the uptime of a windows system in a list manner with days, hours, and minutes. Instead of the last boot time, it just shows the uptime of a system since the last boot.
(get-date) - (gcim Win32_OperatingSystem).LastBootUpTime
Here, gcim
stands for Get – CimInstance.
Sample Output:
PS C:\Users\geekflare> (get-date) - (gcim Win32_OperatingSystem).LastBootUpTime
Days : 7
Hours : 8
Minutes : 44
Seconds : 38
Milliseconds : 884
Ticks : 6362788845605
TotalDays : 7.36433894167245
TotalHours : 176.744134600139
TotalMinutes : 10604.6480760083
TotalSeconds : 636278.8845605
TotalMilliseconds : 636278884.5605
If you’re using PowerShell 6 or above, you can get the Windows uptime and last boot time easily with the following command:
Get-Uptime -Since
To see all the properties and methods of Get-CimInstance, use the following command.
Get-CimInstance Win32_OperatingSystem | Get-Member
This command provides the info of all the Get-CimInstance methods and their properties.
Get-WmiObject
You can easily query the last boot time for your PC using the PowerShell Get-WmiObject command, as shown below.
(Get-WmiObject Win32_OperatingSystem).LastBootUpTime
Sample Output:
PS C:\Users\geekflare> (Get-WmiObject Win32_OperatingSystem).LastBootUpTime
20220220132640.500000+330
You’ll see an output that appears awkward at first, but it’s not difficult to read and understand. You can easily figure out the last boot time of your windows machine.
The information below can be used to break down the LastBootUpTime 20220220132640.500000+330
.
- Year: 2022.
- Month: 02.
- Day: 20.
- Hour: 13.
- Minutes: 26.
- Seconds: 40.
- Milliseconds: 500000.
- GMT: +330 (5 and half hours ahead of GMT).
Or you can also use another Get-WmiObject command to query the last boot time of the system.
Get-WmiObject win32_operatingsystem | select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}
The lastbootuptime
will be converted into big integer format, which will be finally displayed in a readable format.
Sample Output:
PS C:\Users\geekflare> 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 net statistics command displays system statistics such as bytes of data received and total uptime since the computer’s last boot.
net statistics workstation | select-string "Statistics"
You can also use the following shortcut:
net stats work | select-string "Stat"
Sample Output:
PS C:\Users\geekflare> net statistics workstation | select-string "Statistics"
Workstation Statistics for \\LAPTOP-9A5G7BR4
Statistics since 2/20/2022 1:28:32 PM
System Info
The systeminfo
utility command can be used to obtain the computer’s most recent boot time by loading and analyzing processor, Hotfix, and Hyper-V information.
systeminfo
This command displays the Hostname, OS version, build-type, configuration, bios version, boot time, software installation date, and every detail.
From all this data, if you want to see only the specific required data, Then you need to pass the Select -string additional utility to the systeminfo
command.
Just type 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 searches input strings and files for text patterns using regular expression matching.
The above command fetches the local computer’s most recent reboot time and prints the OS version of a system and windows system last Boot Time to the terminal, as shown below.
Sample Output:
PS C:\Users\geekflare> systeminfo | Select-String "OS version","System Boot Time"
OS Version: 10.0.22000 N/A Build 22000
System Boot Time: 2/20/2022, 1:26:40 PM
BIOS Version: Insyde F.18, 3/15/2019
Command prompt
You can also use the command line to check the uptime or last boot time of your Windows system with some commands and utilities like net stats
, wmic
, and systeminfo
.
System Info
The command systeminfo
displays generic information about the Windows operating system and its configuration. It displays the last time Windows was booted. If you want uptime, you need to manually determine how much time has passed since the last boot.
Open a command prompt and type the following command.
systeminfo | find "System Boot Time"
Sample Output:
C:\Users\geekflare>systeminfo | find "System Boot Time"
System Boot Time: 2/20/2022, 1:26:40 PM
WMIC
WMIC ( Windows Management Instrumentation Command-line ) command will provide you with a string representation of the computer’s last boot time. The result is formatted as a four-digit year with two digits for month, day, hour, minute, and second.
Open a command prompt and type the following command.
wmic path Win32_OperatingSystem get LastBootUpTime
Sample Output:
C:\Users\geekflare>wmic path Win32_OperatingSystem get LastBootUpTime
LastBootUpTime
20220220132640.500000+330
This output can be read as 2022, month 2, day 20, hour 13 (or 1:00 PM), minute 26, and so on.
Net Stats
The net statistics command displays system statistics such as bytes of data received, bytes of data transferred, the number of connections made, and total uptime since the last boot of the computer.
To see the services running in the windows machine, use the below command.
net stats
This command just displays the available running services in the system.
We can get statistics for either the server or workstation using the context NET STATISTICS with the following command.
net stats workstation
Here, I provided the workstation in command to see statistics.
Sample Output:
C:\Users\geekflare>net stats workstation
Workstation Statistics for \\LAPTOP-9A5G7BR4
Statistics 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 0
The command completed successfully.
This command can be used from within a batch file, and the output can be filtered using the “find” command. For example, if you want to find only the last boot time of the system, use the following command.
net statistics workstat
Sample Output:
C:\Users\geekflare>net statistics workstation | find "Statistics"
Workstation Statistics for \\LAPTOP-9A5G7BR4
Statistics since 2/20/2022 1:28:32 PM
And if you want to find the Windows Server uptime, the command will become the net statistics server
.
Task Manager
This is the simplest way to check your device uptime. Instead of showing the last boot time, it shows the uptime of the system since the last boot.
- To open Task Manager, simply use the Ctrl + Shift + Esc keyboard shortcut.
- Navigate to the Performance tab.
- The system uptime will be displayed near the bottom of the window.
This means the system was rebooted before 8 days, 8 hours, and 29 minutes.
Conclusion
These are some of the methods for quickly obtaining the windows system’s most recent boot time or uptime.
Every command has its own set of benefits. You can choose the way that best matches your needs.
I hope you found this article very useful in learning how to get the last boot time of a windows system in different ways.
You may also be interested in learning about the top tools to monitor windows servers.