How to get system boot time in Powershell?

System boot time for a local or remote computer can be easily fetched using Powershell cmdlets. There are multiple ways by which you can organize the system boot time information. System boot time refers to the timestamp when the system booted up. It is a very useful indicator for the servers, and helps in establishing reliability of the server uptime statistics.

We will look at finding system boot time in Powershell using five different methods or commands. All these five commands are discussed below with command output screenshots. You could replicate any of these commands for finding the system boot time on a local or remote computer.

Find System boot time using wmic command in Powershell

The simplest and quickest way to find the system boot time is by using the wmic command. The only thing that may sound cumbersome is about making sense of the command output for wmic since the reported time is in the WMI format. We have explained this below. The exact command to find the system boot time using the wmic command is:

wmic OS get lastbootuptime

The command output for this command looks like the screenshot below.

System boot time using wmic command in Powershell

The number 20221207093431 contains the actual timestamp of the system boot time. From this number, we infer that the system booted on 7th December 2022 at 0934 hours.

System boot time using systeminfo in Powershell

The Systeminfo command remains one of the most used cmdlets to find system information in Powershell. System boot time details can be fetched using the following systeminfo command in Powershell:

systeminfo | find /i “Boot Time”

The output of this command is easier to comprehend. We have displayed the command output below in the screenshot.

System boot time using systeminfo command in Powershell

The command output above shows that the system booted up on 7th December 2022 at 0934 hours.

System boot time using WMI Object in Powershell

WMI Object method is another good way to fetch system boot time details. The WMI Object method will use the Win32_engineering class to get the system boot time.

The exact command to get the system boot time using the WMI Object method is given below.

Get-WmiObject Win32_OperatingSystem | Select Lastbootuptime

The output of this command shows the system boot time in WMI format. So, you will need to convert the WMI format to standard date format using one of the functions.

Last boot time using WMI Object in Powershell.

Alternatively, you could look at CIM Instance method to pull system boot time details in the standard date format in Powershell.

CIM Instance to get system boot time in Powershell

The CIM Instance method offers system boot time in the standard date format. With a single command, you get the system boot time information that is organized well. The command using CIM Instance is shared below:

(get-date) – (get-ciminstance Win32_OperatingSystem). LastBootUpTime

The output of this command looks like the screenshot below. The command output offers system boot time in terms of days, hours, and minutes for easier understanding.

System boot time using CIM Instance

System boot time using netstatistics command in Powershell

The net statistics command can help you in collecting the system boot time information through a single command. The exact command is shared below.

net statistics workstation | select-string “statistics”

The output of this command tells you the date on which the system booted. The command output looks like the screenshot below.

Net statistics command for system boot time in Powershell

Summary

In this Powershell tutorial, we have seen how we can get the system boot time using one of the following methods:

  • using the wmic command
  • using the systeminfo command
  • using the WMI Object method
  • using the CIM Instance method
  • using the net statistics command

You could use any of these methods to get the system boot time. However, the CIM instance output in the standard date format may be more understandable and meaningful on the first go.

Rajesh Dhawan

Rajesh Dhawan is a technology professional who loves to blog about smart wearables, Cloud computing and Microsoft technologies. He loves to break complex problems into manageable chunks of meaningful information.