Windows last boot time

on January 29, 2012

You can find the time windows was last rebooted on your computer using systeminfo or wmic commands. Both the commands are explained below.

Using Systeminfo:

You can run the below command to find the Windows boot time.

systeminfo | findstr /C:"System Boot Time"

The above command works on Windows 7. If you are using Windows XP, then you need to run a slightly different command.

systeminfo | findstr /C:"System Up Time"

Example:

c:\>systeminfo | findstr /C:"System Boot Time"
System Boot Time:          1/29/2012, 4:54:04 PM

Using WMIC:

We can find the boot time using wmic os command.

c:\>wmic os get lastBootUpTime
LastBootUpTime
20120129165404.109999+330
c:\>

WMIC command shows the time up to milliseconds.

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.

В этой статье мы покажем, как получить время непрерывной работы компьютера (uptime), которое прошло с момента загрузки Windows.

Самый простой способ получить время последней загрузки Windows – выполнить команду:

systeminfo | FIND "System Boot Time"

System Boot Time: 3/11/2023, 11:58:45 AM

systeminfo узнать время загрузки Windows

Также время загрузки можно получить так:

net statistics workstation

Чтобы получить не просто дату загрузки, а время непрерывной работы с последней загрузки можно воспользоваться таким скриптом PowerShell:

$WinOS = Get-WmiObject Win32_OperatingSystem
write-host $WinOS.LastBootUpTime
(Get-Date) — $WinOS.ConvertToDateTime($WinOS.LastBootUpTime)

В этом примере компьютер Windows работает без перезагрузок 26 дней.

В этом примере командлет Get-WmiObject используется для обращения к классу Win32_OperatingSystem.

В PowerShell Core вместо командлета Get-WmiObject нужно использовать Get-CimInstance:

Get-CimInstance -ClassName win32_operatingsystem -ComputerName localhost| select csname, lastbootuptime

или

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

Также в PowerShell Core 6.x и 7.x доступен новый командлет Get-Uptime, который сразу выводит Uptime (вычисляет TimeSpan между текущим временем и временем последней загрузки Windows):

Get-Uptime
Get-Uptime -Since

Вы можете получить uptime с удаленных компьютеров из командной строки.

Можно подключиться к удаленному компьютере через systeminfo и получить BootTime:

SystemInfo /s msksrv01 | find "Boot Time:"

Или через CIM получить время непрерывной работы удаленного компьютера:

(Get-Date) - (Get-CimInstance Win32_OperatingSystem -ComputerName msksrv01).LastBootupTime

Либо можно проверить время загрузки сразу несколько удаленных хостов Windows с помощью PowerShell (имена серверов указываются через запятую):

Get-CimInstance win32_operatingsystem -computerName server1,server2,server3 | select-object csname,LastBootUpTime

There are several ways to find out how long Windows has been running (uptime) since the last boot.

You can use the Task Manager GUI to view the total Windows uptime.

  1. Open the Task Manager (run the taskmgr.exe command or press the Ctrl+Shift+Esc)
  2. Go to the Performance tab -> select CPU
  3. Check the Up time value

You can also get the last boot time of the computer by using the command:

systeminfo

System Boot Time is the time Windows was last restarted (booted).

In this case, only the last boot time is displayed at the command prompt. To calculate the uptime value as the difference between the current time and the Windows boot time, use the following PowerShell commands:

$boot_time = Get-CimInstance Win32_OperatingSystem | select LastBootUpTime
(Get-Date) - $boot_time.LastBootUpTime | select Days,Hours,Minutes,Seconds

The commands will return the computer’s uptime value in days and hours.

In the new PowerShell Core 6.x and 7.x versions, the new Get-Uptime cmdlet can be used to check the system uptime. This cmdlet returns the uptime value in days, hours, and minutes (in TimeSpan format). Or view the last Windows boot time

Get-Uptime -Since

You can get uptime from a remote computer:

$remotePC='hqpc12b23'
(Get-Date) - (Get-CimInstance Win32_OperatingSystem -ComputerName $remotePC).LastBootupT
ime

This command can be used to remotely query the uptime of multiple computers in an AD domain. The Get-ADComputer cmdlet is typically used to get a list of domain-joined computers.

Note that on desktops running Windows 10 and 11, the hybrid boot feature (Fast Startup) is enabled by default. In this mode, when the user turns off the computer, Windows does not power off the device, but instead unloads the kernel and drivers into a hibernation file. In this case (as well as after waking from sleep or hibernation), the computer’s uptime is not reset after it is powered on.

Nowadays most of them are not shutting down our computers, some people or in some companies the system keep running for days or even months. Even laptop users are doing the same thing without any concern. Because most of the people don’t want to wait until the system gets restarted and Some people want to work immediately with their login. Restarting the system will take time and some time in windows 10 the system will get stuck on the windows 10 update page and that will take more than 20-30 mins of boot time. But Lot of users aren’t aware of why a restart is required and what happens if we didn’t restart our system. If you didn’t restart your system or laptop for many days your computer will run slow and it will freeze-ups a lot of time. It may lead to driver or hardware error, The internet speed will lag and there may be a chance of dysconnectivity in the internet connection. And the system won’t update if you didn’t restart your system if there is any security update it will be in pending status and this cause the system Slowness.

What are the Benefits of Restarting Computer?

Flushes RAM Speeds up Performance Stops Memory Leaks Fixes Internet Connection Bug Fixes Saves Time Most if the windows 10 users put their system in Hibernation or fast startup state to make the system boot fast. This article will guide you to Check Windows 10 last boot Time and Status. And what type of startup option it takes while booting. In windows 10 there are three types of startup options, Fast Startup, Full Shutdown, and Hibernation Mode.

Fast Startup:

Fast Startup is a Windows 10 feature designed to reduce the time it takes for the computer to boot up from being fully shut down. However, it prevents the computer from performing a regular shutdown and can cause compatibility issues with devices that do not support sleep mode or hibernation.

Full Shutdown:

By the name itself you can identify this startup option, Full shutdown will close all apps, sign out all users, and completely turn off the PC or Laptop. If you are a laptop user Performing a full shutdown can extend your battery’s life.

Hibernation Mode:

Hibernation Mode is a combination of the Sleep and Hibernate modes meant for desktop computers. It puts any open documents and applications in memory and on your hard disk, and then puts your computer into a low-power state, allowing you to quickly wake the computer and resume your work.

Method 1: Using Task Manager

In this method, you can find how long your computer was running.

Open Run command by pressing Windows + R and type taskmgr and hit enter this will open the Task Manager.

Now go to the Performance Tab and click on the CPU section. At the bottom of the window, you can see the Uptime.

Check last boot Time and Status using Task manager

My system is been up for 17 days.

Method 2: Using Command Prompt

Using command Prompt you can see the Exact system reboot date and time Open Command Prompt as admin mode and enter the following command and hit enter.

net statistics workstation

Check last boot Time using command Prompt

Now you will get the date and time of the system reboot. And this command will works in all the versions of windows.

Method 3: using PowerShell

Using PowerShell, we can check windows reboot time and the last boot was from Fast Startup, Full Shutdown, or Hibernate

Open PowerShell from the Start menu and Copy Past the following Commands into PowerShell Window and hit enter.

Get-WinEvent -ProviderName Microsoft-Windows-Kernel-boot -MaxEvents 10 | Where-Object {$_.id -like “27”} Or Get-WinEvent -ProviderName Microsoft-Windows-Kernel-boot -MaxEvents 10 | Where-Object {$_.message -like “The boot type*”}

As per the below image you can see the boot time of the system clearly, also you can see the Boot type was 0x0. This shows what type of boot type was taken by the system. You can compare this value from the below chart.

Check last boot Time and status using PowerShell

0x0                cold boot from full shutdown 0x1                 hybrid boot (fast startup) 0x2                 resume from hibernation

You can check your system boot time and status  and mention how long your system is running in commands.

Post Views: 2,402

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Варианты входа windows 10 этот параметр сейчас недоступен
  • Приоритет загрузки в bios windows boot manager
  • Не меняется раскладка клавиатуры windows 10 сочетание клавиш
  • Код ошибки 0x80072efe при обновлении windows 7
  • Как сделать запуск от имени администратора в windows 11 по умолчанию