- Adam the Automator
- How to Check Windows Server Uptime
- Nathan Kasco
- Checking Windows Server Uptime
- Task Manager
- Event Viewer
- PowerShell
- System Information Utility
- Net Statistics Command
- Uptime Command
- Introducing the Get-ServerUptimeReport script
- Finding Uptime Across Many Servers
- Summary
- служба времени Windows Windows Time Service
- Поиск сведений о конфигурации службы времени Windows Where to Find Windows Time Service Configuration Information
- Принцип работы службы времени Windows What is the Windows Time Service?
- Важность протоколов времени Importance of Time Protocols
Adam the Automator
How to Check Windows Server Uptime
Nathan Kasco
Read more posts by this author.
Windows uptime is a measurement that many server administrators use to troubleshoot day-to-day issues that may arise in the environment. In this article, you’re going to learn all the ways to check Windows Server and Windows 10 uptime. You’re free to use whichever way is easiest for you. Use this article as a future reference.
The article will be broken up into two main parts; checking server uptime and finding historical Windows uptime. The first part will focus on finding how much time the computer has been up since it’s last reboot. This is called “current” uptime in this article.
The second part of the article will focus on finding “historical” uptime meaning a reboot on how long a Windows system was up between multiple reboots. Using PowerShell, you’ll learn how to parse the Windows event log to pull historical uptime numbers.
Table of Contents
Checking Windows Server Uptime
To get started, let’s now jump into a few different ways to find the current Windows uptime.
You’ll be seeing a demonstration of running command locally on a Windows system through this section. But know that by using PowerShell Remoting, you can also perform these checks remotely (excluding task manager).
Task Manager
One of the most simple and straightforward ways to find uptime is to simply open Task Manager.
To check Windows uptime with Task Manager, right-click the Windows taskbar and select Task Manager or press Ctrl–Shift–Esc. Once Task Manager is open, click on the Performance tab. Under the Performance tab, you will see a label of Up Time.
Event Viewer
Event Viewer is very commonly used by most sysadmins on a regular basis, which makes it a great option for a non-command line related method of retrieving uptime. Event ID 6005 and 6006 can be used to identify when the event log service starts or stops, which occurs during boot/shut down times. Follow these steps to identify uptime via Event Viewer:
- Bring up the Start Menu and simply search for Event Viewer, you can also get to it via Computer Management.
- On the left, expand the Windows Logs section and select System
- Now that we are querying only System related events, click “Filter Current Log…” on the right hand side of your window
- In the Event ID field (by default this will be prefilled with text stating “All Event IDs”) we need to search for our applicable Event IDs, type “6005, 6006” then click OK
You can then compare the two times to create a total uptime. Also, since many instances of these event s are stored, we can query a history of uptimes!
You now have filtered Event Logs that will show you not only the last time, but all known times in which there has been a boot up/shut down.
PowerShell
PowerShell has a few different ways you can retrieve uptime. You can either query WMI or use the Windows event log.
When querying WMI, you can query the Win32_OperatingSystem class and select the LastBootUpTime property as shown below.
To query the Event Log via PowerShell, use the Get-WinEvent cmdlet. You’ll need to search for event IDs 6005 or 6006 that indicate the last time the machine was started.
WMIC provides a command-line interface for WMI and is a tried and true method that has been used for many years. To query via uptime via WMIC you query the Win32_OperatingSystem WMI class again although a bit under the covers. You can see below you can use the WMIC syntax os get lastbootuptime to return the last time the server was started.
You do not have to download anything to leverage WMIC, as it comes pre-installed with Windows.
System Information Utility
The systeminfo command displays detailed configuration info about a computer and can be used to query system uptime. By using the built-in find command line tool you can parse the text to retrieve the data you need.
Simply open up either Command Prompt or PowerShell and type systeminfo | find .
You do not have to download anything to leverage systeminfo , as it comes pre-installed with Windows.
Net Statistics Command
You can also quickly query uptime via Net Statistics or more commonly known as net stats . The net stats command returns general information about your session. You can see below the Statistics since… line. This date indicates when the machine was started.
Uptime Command
If you need a small, portable utility to find Windows uptime, look no further than NeoSmart Technologies’ Uptime command for Windows. This utility is perfect for quickly querying uptime on any Windows version. The major benefit of this tool is the convenience factor. If you find yourself using this many times per day you may want to consider this method.
After downloading the tool, extract uptime.exe to %WinDir%\System32. Then open up a command prompt and simply type uptime .
To run this tool remotely, you’d first need to copy the tool to the Windows systems you’re checking uptime on.
Introducing the Get-ServerUptimeReport script
So you don’t have to write the PowerShell yourself, download a community script called Get-ServerUptimeReport.ps1.
This script allows you to provide a computer name as a parameter. It will then parse the System event log of the computer and find both a start and stop event to compare the two. It will then return the total time the server was online until the event log has rolled.
Below is an example of using this script on a server. It will return the total uptime for all of the events the server has in the event log, including the current uptime.
Finding Uptime Across Many Servers
This script is a quick way to find the uptime of a single server across many days. But what if you need this information for lots of servers at once? To do this, you can gather up a list of servers and then pass each computer name, one at a time, to this script.
As an example, define all your servers in an array in the PowerShell console. In this example, the variable array will be called $servers .
In reality though, you might be pulling server names from Active Directory, Hyper-V, or a text file. As long as you can build an array of server names, you’re fine.
Define all the server names and then iterate over each one with a loop, as shown below.
This code works, but you can’t determine which server each row references. Add a server name to the output like below using a calculated property.
We now have an excellent little tool that can provide us a quick report on uptime for our servers over time!
Summary
You’ve now seen many different ways to find Windows uptime. Regardless of which option you choose, you’ll receive the same information. Choose the best one for your own context.
And remember if you need a historical report of uptime history, don’t forget about the Get-ServerUptimeReport PowerShell script!
служба времени Windows Windows Time Service
Применяется к: Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, Windows 10 или более поздних версий Applies to: Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, Windows 10 or later
В данном руководстве In this guide
- Поиск сведений о конфигурации службы времени Windows Where to find Windows Time Service Configuration Information
- Принцип работы службы времени Windows What is the Windows Time Service?
- Важность протоколов времени Importance of Time Protocols
- Принцип работы службы времени Windows How the Windows Time Service Works
- Средства и параметры службы времени Windows Windows Time Service Tools and Settings
В Windows Server 2003 и Microsoft Windows 2000 Server служба каталогов называется «служба каталогов Active Directory» In Windows Server 2003 and Microsoft Windows 2000 Server, the directory service is named Active Directory directory service. В Windows Server 2008 и Windows Server 2008 R2 служба каталогов называется «доменные службы Active Directory» (AD DS). In Windows Server 2008 R2 and Windows Server 2008 , the directory service is named Active Directory Domain Services (AD DS). Остальная часть этой статьи относится к AD DS, но эти сведения применимы также и к доменным службам Active Directory в Windows Server 2016. The rest of this topic refers to AD DS, but the information is also applicable to Active Directory Domain Services in Windows Server 2016.
Служба времени Windows, также известная как W32Time, синхронизирует дату и время для всех компьютеров, работающих в домене AD DS. The Windows Time service, also known as W32Time, synchronizes the date and time for all computers running in an AD DS domain. Синхронизация времени важна для правильной работы многих служб Windows и бизнес-приложений. Time synchronization is critical for the proper operation of many Windows services and line-of-business applications. Служба времени Windows использует протокол сетевого времени (NTP) для синхронизации компьютерных часов в сети, чтобы можно было назначить точное значение времени или отметку времени запросам проверки сети и доступа к ресурсам. The Windows Time service uses the Network Time Protocol (NTP) to synchronize computer clocks on the network so that an accurate clock value, or time stamp, can be assigned to network validation and resource access requests. Служба интегрирует поставщики NTP и времени, что делает ее надежной и масштабируемой службой времени для корпоративных администраторов. The service integrates NTP and time providers, making it a reliable and scalable time service for enterprise administrators.
До Windows Server 2016 служба W32Time не предназначалась для поддержки зависящих от времени потребностей приложений. Prior to Windows Server 2016, the W32Time service was not designed to meet time-sensitive application needs. Не теперь обновления Windows Server 2016 позволяют реализовать в домене решение с точностью 1 мс. However, updates to Windows Server 2016 now allow you to implement a solution for 1ms accuracy in your domain. Дополнительные сведения см. в статьях Windows 2016 Accurate Time (Точное время для Windows Server 2016) и Support boundary for high-accuracy time (Граница области поддержки для сверхточного времени). See Windows 2016 Accurate Time and Support boundary to configure the Windows Time service for high-accuracy environments for more information.
Поиск сведений о конфигурации службы времени Windows Where to Find Windows Time Service Configuration Information
В этом руководстве не затрагивается настройка службы времени Windows. This guide does not discuss configuring the Windows Time service. В Microsoft TechNet и в базе знаний Майкрософт есть несколько разделов, которые описывают процедуры настройки службы времени Windows. There are several different topics on Microsoft TechNet and in the Microsoft Knowledge Base that do explain procedures for configuring the Windows Time service. Если вам требуется информация о конфигурации, вы сможете найти ее в следующих статьях. If you require configuration information, the following topics should help you locate the appropriate information.
Сведения о том, как настроить службу времени Windows для эмулятора основного контроллера домена в корне леса, см. в этих статьях: To configure the Windows Time service for the forest root primary domain controller (PDC) emulator, see:
Статья 816042 базы знаний Майкрософт Как настроить полномочный сервер времени в операционной системе Windows Server, в которой описаны параметры конфигурации для компьютеров под управлением Windows Server 2008 R2, Windows Server 2008, Windows Server 2003 и Windows Server 2003 R2. Microsoft Knowledge Base article 816042, How to configure an authoritative time server in Windows Server, which describes configuration settings for computers running Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, and Windows Server 2003 R2.
Сведения о настройке службы времени Windows на любом клиенте- или сервере-члене домена или даже на контроллерах домена, которые не настроены в качестве эмулятора основного контроллера в корне леса, см. в этой статье. To configure the Windows Time service on any domain member client or server, or even domain controllers that are not configured as the forest root PDC emulator, see Configure a client computer for automatic domain time synchronization.
Некоторые приложения могут требовать наличия высокоточных служб времени на компьютерах, где они работают. Some applications may require their computers to have high-accuracy time services. В этом случае вы можете настроить источник времени, задаваемый вручную, но имейте в виду, что служба времени Windows не предназначена для работы в качестве источника с высокой точностью времени. If that is the case, you may choose to configure a manual time source, but be aware that the Windows Time service was not designed to function as a highly accurate time source. Убедитесь, что вы знаете об ограничениях поддержки для сред высокой точности, описанных в статье 939322 базы знаний Майкрософт: Support boundary for high-accuracy time (Граница области поддержки для высокоточного времени). Ensure that you are aware of the support limitations for high-accuracy time environments as described in Microsoft Knowledge Base article 939322, Support boundary to configure the Windows Time service for high-accuracy environments.
Чтобы настроить службу времени Windows на всех клиентских и серверных компьютерах под управлением Windows, которые настроены как члены рабочей группы, а не члены домена, см. статью Configure a Manual Time Source for a Selected Client Computer (Настройка источника времени вручную для выбранного клиентского компьютера). To configure the Windows Time service on any Windows-based client or server computers that are configured as workgroup members instead of domain members see Configure a manual time source for a selected client computer.
Сведения о настройке службы времени Windows на главном компьютере, на котором выполняется виртуальная среда, см. в статье 816042 базы знаний Майкрософт Как настроить полномочный сервер времени в операционной системе Windows Server. To configure the Windows Time service on a host computer that runs a virtual environment, see Microsoft Knowledge Base article 816042, How to configure an authoritative time server in Windows Server. Если вы работаете с продуктом виртуализации не от Майкрософт, обязательно ознакомьтесь с документацией поставщика для этого продукта. If you are working with a non-Microsoft virtualization product, be sure to consult the documentation of the vendor for that product.
Чтобы настроить службу времени Windows на контроллере домена, работающем в виртуальной машине, мы рекомендуем частично отключить синхронизацию времени между хост-системой и гостевой операционной системой, выполняющей роль контроллера домена. To configure the Windows Time service on a domain controller that is running in a virtual machine, it is recommended that you partially disable time synchronization between the host system and guest operating system acting as a domain controller. Это позволяет гостевому контроллеру домена синхронизировать время для иерархии домена, но предохраняет его от отклонения во времени при восстановлении из сохраненного состояния. This enables your guest domain controller to synchronize time for the domain hierarchy, but protects it from having a time skew if it is restored from a Saved state. Дополнительные сведения см. в статье 976924 базы знаний Майкрософт You receive Windows Time Service event IDs 24, 29, and 38 on a virtualized domain controller that is running on a Windows Server 2008-based host server with Hyper-V (Вы получаете события с кодами 24, 29 или 38 от службы времени Windows на виртуализированном контроллере домена, который выполняется на сервере узла под управлением Windows Server 2008 с Hyper-V) и статье Deployment Considerations for Virtualized Domain Controllers (Рекомендации по развертыванию виртуализованных контроллеров домена). For more information, see Microsoft Knowledge Base article 976924, You receive Windows Time Service event IDs 24, 29, and 38 on a virtualized domain controller that is running on a Windows Server 2008-based host server with Hyper-V and Deployment Considerations for Virtualized Domain Controllers.
Чтобы настроить службу времени Windows на контроллере домена, работающем в качестве эмулятора основного котроллера в корне леса, который также работает на виртуальном компьютере, следуйте тем же инструкциям, что и для физического компьютера, как описано в статье Configure the Windows Time service on the PDC emulator in the Forest Root Domain (Настройка службы времени Windows для эмулятора основного контроллера домена в корневом домене леса). To configure the Windows Time service on a domain controller acting as the forest root PDC emulator that is also running in a virtual computer, follow the same instructions for a physical computer as described in Configure the Windows Time service on the PDC emulator in the Forest Root Domain.
Чтобы настроить службу времени Windows на рядовом сервере, работающем как виртуальный компьютер, используйте иерархию времени домена, как описано в статье Configure a Client Computer for Automatic Domain Time Synchronization (Настройка клиентского компьютера для автоматической синхронизации времени домена). To configure the Windows Time service on a member server running as a virtual computer, use the domain time hierarchy as described in (Configure a client computer for automatic domain time synchronization.
Принцип работы службы времени Windows What is the Windows Time Service?
Служба времени Windows (W32Time) обеспечивает синхронизацию сетевых часов для компьютеров без необходимости в расширенной настройке. The Windows Time service (W32Time) provides network clock synchronization for computers without the need for extensive configuration.
Служба времени Windows необходима для успешной работы проверки подлинности Kerberos версии 5 и, следовательно, для проверки подлинности на основе AD DS. The Windows Time service is essential to the successful operation of Kerberos version 5 authentication and, therefore, to AD DS-based authentication. Любое приложение, поддерживающее Kerberos, включая большинство служб безопасности, зависит от синхронизации времени между компьютерами, участвующими в запросе проверки подлинности. Any Kerberos-aware application, including most security services, relies on time synchronization between the computers that are participating in the authentication request. Контроллеры доменов AD DS также должны иметь синхронизированные часы, чтобы обеспечивать точную репликацию данных. AD DS domain controllers must also have synchronized clocks to help to ensure accurate data replication.
Служба времени Windows реализована в библиотеке динамической компоновки с именем W32Time.dll. The Windows Time service is implemented in a dynamic link library called W32Time.dll. Служба W32Time.dll устанавливается по умолчанию в папку %Systemroot%\System32 во время установки и настройки операционной системы. W32Time.dll is installed by default in the %Systemroot%\System32 folder during operating system setup and installation.
Служба W32Time.dll изначально разрабатывалась для Windows 2000 Server и поддержки спецификации протоколом проверки подлинности Kerberos версии 5, требующей синхронизации в сети. W32Time.dll was originally developed for Windows 2000 Server to support a specification by the Kerberos V5 authentication protocol that required clocks on a network to be synchronized. Начиная с Windows Server 2003, служба W32Time.dll обеспечивала повышенную точность синхронизации сетевых часов в операционной системе Windows 2000 Server и, кроме того, поддерживала различные аппаратные устройства и протоколы сетевого времени с использованием поставщиков времени. Starting with Windows Server 2003, W32Time.dll provided increased accuracy in network clock synchronization over the Windows 2000 Server operating system and, in addition, supported a variety of hardware devices and network time protocols by means of time providers. Несмотря на то, что изначально планировалось обеспечить синхронизацию часов для проверки подлинности Kerberos, теперь множество приложений используют метки времени для обеспечения согласованности транзакций, записи времени важных событий и другой критически важной для бизнеса информации, которая зависит от времени. Although originally designed to provide clock synchronization for Kerberos authentication, many current applications use timestamps to ensure transactional consistency, to record the time of important events, and other business-critical, time-sensitive information. Эти приложения получают преимущества от синхронизации времени между компьютерами, которую обеспечивает служба времени Windows. These applications benefit from time synchronization between computers that is provided by the Windows Time service.
Важность протоколов времени Importance of Time Protocols
Протоколы времени взаимодействуют между двумя компьютерами для обмена сведениями о времени, а затем используют эти сведения для синхронизации часов. Time protocols communicate between two computers to exchange time information and then use that information to synchronize their clocks. При использовании протокола времени службы времени Windows клиент запрашивает сведения о времени с сервера и синхронизирует свои часы на основе полученных данных. With the Windows Time service time protocol, a client requests time information from a server and synchronizes its clock based on the information that is received.
Служба времени Windows использует протокол NTP для синхронизации времени по сети. The Windows Time service uses NTP to help synchronize time across a network. NTP — это протокол времени в Интернете, включающий алгоритмы правил работы, необходимые для синхронизации часов. NTP is an Internet time protocol that includes the discipline algorithms necessary for synchronizing clocks. NTP является более точным протоколом времени, чем Simple Network Time Protocol (SNTP), который используется в некоторых версиях Windows; однако W32Time продолжает поддерживать SNTP для обратной совместимости с компьютерами, на которых работают службы времени на основе SNTP, такие как Windows 2000. NTP is a more accurate time protocol than the Simple Network Time Protocol (SNTP) that is used in some versions of Windows; however, W32Time continues to support SNTP to enable backward compatibility with computers running SNTP-based time services such as Windows 2000.