On Unix, checking uptime couldn't be easier — a command of the same name (uptime) will show it to you. But for some reason Microsoft forgot to include such a command in its products... or maybe they think checking uptime makes no sense, since — unlike on Unix — it will always be very small? I don't know, but the need to find out "how long has this machine actually been running" comes up not only on Linux/BSD.
Let's approach it from another angle — we'll use the "systeminfo" utility, which besides uptime also shows a bunch of other information, mostly unnecessary.
C:\> systeminfo
On
Windows XP/2003 the output of this command will look something like this:
Изготовитель ОС: Microsoft Corporation
Параметры ОС: Основной контроллер домена
Сборка ОС: Multiprocessor Free
Зарегистрированный владелец: Server
Зарегистрированная организация: Myfirm
Код продукта: 69712-640-0394874-45575
Дата установки: 16/05/05, 16:24:57
Время работы системы: 12 дн., 16 час., 39 мин, 52 сек.
Изготовитель системы: To Be Filled By O.E.M. by More String
Модель системы: To Be Filled By O.E.M.
Тип системы: X86-based PC
...
Look for the information you need near the top of the output, on the "Время работы системы" (System Up Time) line.
On
Windows Vista/7/2008 we'll be shown the following information:
Microsoft Windows [Version 6.1.7601]
(c) Корпорация Майкрософт (Microsoft Corporation), 2009. Все права защищены.
C:\Users\reagent>systeminfo
Имя узла: MYSERVER
Название ОС: Microsoft Windows Server 2008 R2 Standard
Версия ОС: 6.1.7601 Service Pack 1 сборка 7601
Изготовитель ОС: Microsoft Corporation
Параметры ОС: Рядовой сервер
Сборка ОС: Multiprocessor Free
Зарегистрированный владелец: Пользователь Windows
Зарегистрированная организация:
Код продукта: 00477-001-0000421-84589
Дата установки: 13/01/11, 20:32:58
Время загрузки системы: 14/08/11, 1:06:58
Изготовитель системы: Xen
Модель системы: HVM domU
Тип системы: x64-based PC
...
In this case Windows has even stopped printing the uptime itself — blushing, it only shows us the time of the last boot, leaving it up to us to calculate the running time ourselves. The information you need is in the "Время загрузки системы" (System Boot Time) field.
Comments