Saturday, June 22, 2019

Finding Windows Uptime from Command Line

To get Windows uptime from the command line, we can instead obtain the boot time of the system, and subtract it from current time. To obtain the boot time, we can do the following,

On a Windows server,

net statistics server | find "Statistics since" 


On a Windows workstation

net statistics workstation | find "Statistics since"


Alternatively, we can use the following,

systeminfo | find "System Boot Time:"

or

wmic path Win32_OperatingSystem get LastBootUpTime

or

echo (get-date) - (gcim Win32_OperatingSystem).LastBootUpTime | powershell

No comments:

Post a Comment