Время непрерывной работы Windows с момента последней перезагрузки (uptime) можно узнать разными способами.
В графическом интерфейсе общее время работы Windows можно найти в диспетчере задач.
- Запустите Task Manager (выполните команды
taskmgr.exe
или нажмите сочетание клавиш
Ctrl+Shift+Esc
) - Перейдите на вкладку Производительность (Performance) -> вкладка ЦП (CPU)
- Время непрерывной работы компьютера содержится в поле Up time
-
Также можно получить текущий uptime из командной строки. Выполните команду:
Systeminfo
Время последней загрузки (перезагрузки) Windows указано в значении System Boot Time.
В данном случае в командной строке отобразится только время последней загрузки. Чтобы вычислить значение uptime, как разницу между текущим временем и временем загрузки Windows, воспользуйтесь PowerShell командами:
$boot_time = Get-CimInstance Win32_OperatingSystem | select LastBootUpTime
(Get-Date) - $boot_time.LastBootUpTime | SELECT Days,Hours,Minutes,Seconds
Команда вернет значение аптайма компьютера в днях и часах.
В новых версиях PowerShell Core 6.x и 7.x для получения времени работы системы можно использовать новый командлет Get-Uptime. Это командлет сразу выведет значение uptime в днях, часах, минутах (в формате TimeSpan). Или можно вывести время с последней загрузки компьютера:
Get-Uptime -Since
Можно получить значение аптайм с удаленного хоста:
$remotePC='pcbuh01'
(Get-Date) - (Get-CimInstance Win32_OperatingSystem -ComputerName $remotePC).LastBootupTime
Эту команду можно использовать для удаленного опроса uptime компьютеров в домене AD. Для получения списка компьютеров обычно используется командлет Get-ADComputer.
Обратите внимание, что на десктопных версиях Windows 10 и 11 по умолчанию включена функция гибридной загруки (Быстрый запуск, Fast Boot). В этом режиме, когда пользователь выключает компьютер, Windows фактически не выключается, а выгружает ядро и драйверы в файл гибернации. В этом случае (как и после пробуждения после режима сна и обычной гибернации) аптайм компьютера не сбрасывается при включении.
Even though there is still no built-in Windows uptime command, the actual uptime of the server/workstation or the system boot time can be checked from the command-line.
In this note i will show several methods of how to check Windows uptime from the command-line prompt and PowerShell.
PowerShell vs. CMD: Each of the commands below works both from the command-line prompt (CMD) and PowerShell.
Windows uptime can be checked using the wmic command:
C:\> wmic os get lastbootuptime
Another method to check Windows uptime from the command-line prompt is by getting the system boot time from the output of the systeminfo command:
C:\> systeminfo - or - C:\> systeminfo | find "System Boot Time:"
Also uptime of the Windows server/workstation can be checked using the net statistics command that returns the date and time since the statistics has been running, that approximately corresponds to the Windows boot time.
Windows server uptime:
C:\> net statistics server - or - C:\> net statistics server | find "Statistics since"
Windows workstation uptime:
C:\> net statistics workstation - or - C:\> net statistics workstation | find "Statistics since"
Was it useful? Share this post with the world!
Как узнать аптайм сервера
Аптайм (uptime) — это время непрерывной работы сервера, т.е. время, прошедшее с момента загрузки операционной системы. С помощью аптайма можно оценить, как долго сервер работает без сбоев и перезагрузок. В операционных системах Windows есть много способов посмотреть аптайм, вот некоторые из них.
Самый простой способ — это запустить Task Manager и перейти на вкладку «Performance».
Атайм можно посмотреть и в свойствах сетевого подключения.
Также аптайм можно определить по системным логам. При выключении и перезагрузке сервера происходит остановка и запуск службы Event Log, поэтому мы можем открыть Event Viewer и отфильтровать события с кодом 6006 (остановка) или 6005 (старт службы).
Узнать время последнего старта операционной системы можно из командной строки, введя команду systeminfo и найдя строку System Boot Time.
Можно ввести команду net statistics workstation и посмотреть, с какого момента времени собирается статистика. Как правило, это момент загрузки системы.
Ну и конечно для выяснения аптайма можно воспользоваться WMI и PowerShell. Выяснить время старта ОС можно вот так:
$wmi = Get-WmiObject Win32_OperatingSystem
$wmi.LastBootUpTime
Время выводится в несколько неудобном формате, поэтому сконвертируем его:
$wmi.ConvertToDateTime($wmi.LastBootUpTime)
И выведем время работы с точностью до миллисекунды, вычтя из текущей даты дату последней загрузки:
$wmi.ConvertToDateTime($wmi.LocalDateTime) — $wmi.ConvertToDateTime($wmi.LastBootUpTime)
You can check the uptime of your Windows® Server® from the command line by running either the net statistics server
or the systeminfo command.
In addition to uptime, the net statistics server command also displays statistics for the system, such as the number of
files that are being accessed, systems errors, permission violations, password violations, and the total uptime since the last
time the server was restarted. Use the following steps to check server uptime by using the net statistics server command:
-
Connect to your cloud server on the command line.
-
Type
net statistics serverand press Enter.Note: You can also shorten this command to
net stats srv. -
Look for the line that starts with
Statistics since, which indicates the date and time when the uptime started.
The systeminfo command reports the following additional information about the operating system (OS)
that is installed on the server:
Host NameOS NameOS VersionOriginal Install dateSystem Boot TimeSystem TimeTimezoneTotal Physical MemoryVirtual Memory: Max SizeVirtual Memory: AvailableVirtual MemoryNetwork Card
Use the following steps to check server uptime by using the systeminfo command:
- Connect to your cloud server on the command line.
- Type
systeminfoand press Enter. - Look for the line that starts with
Statistics since, which indicates the date and time when the uptime started.
Updated 2 months ago
In this guide, I’ll show you how to check the uptime of a Windows Server and Windows client computers.
Checking the Windows uptime will show you how long the server has been running since it was last rebooted. This comes in useful when troubleshooting a Windows server for performance or application issues.
Windows Server Uptime Command
In this example, I’ll use a simple Windows command to check the server uptime.
-
Open the command prompt:
Copy and paste the command below:
systeminfo | find “System Boot Time” -
Check the system Boot Time:
The command will display the date of the last boot time.
Option#2 Windows Uptime GUI Tool
In this example, I’ll use the AD Pro Toolkit to check the update on all computers.
Step 1. Open the AD Pro Toolkit and click on Windows Uptime.
Step 2. Click “Run” to get the uptime on all servers and computers.
I don’t have many computers in my test environment but you can see how easy the toolkit makes it for generating a report on uptime and last boot.
You can also export the report to csv, xlsx, and PDF by clicking the export button.
Download Free Trial
How to Check Windows Server Uptime with PowerShell
This command will work on PowerShell 5.1 or later versions.
Open PowerShell and use the command below.
(get-date) – (gcim Win32_OperatingSystem).LastBootUpTime
This command will show you how long it has been since the last reboot. It will display the uptime in days, hours, minutes, and seconds.
Another Powershell command that can be used to get the server uptime is the get-uptime cmdlet. The get-uptime cmdlet requires PowerShell version 6 or later.
Unfortunately, the get-uptime cmdlet has no parameter for checking the uptime on remote computers, it only works locally. See method 2 for a quick and easy way to get the uptime on remote and multiple computers.
Check Windows Uptime using Task Manager
You can easily check the uptime on a Windows system by using the task manager.
- Right click the taskbar and select task manaager
- Click on the Performance tab
- The up time will be displayed under the CPU graph.
Check Windows Uptime with Net Statistics
In this last example, I’ll use the net statistics command. This command will show various network statistics but also keeps track of the uptime.
- Open the command prompt
- Enter the command -> net statistics workstation
- The uptime will be at the top
Summary
As an administrator of Windows systems, you will often need to check the uptime on servers and client computers. If you need to manually a single computer there a several command line options to easily see the uptime. If you need to generate a report on multiple or all systems then I would recommend using the uptime utility from the AD Pro Toolkit.
I hope this article helped you find the uptime on your Windows server or workstations. If you liked this article, then please subscribe to our YouTube Channel for more Active Directory tutorials.
