Retrive the Windows uptime using the CLI

Windows uptime net stats srv systeminfo

2 min read | by Jordi Prats

System uptime can be useful for both casual competitions among friends to see who has the system with the longest uptime, as well as for more practical purposes such as identifying if a problem is caused by a system restart. In this article, we will explore two methods for obtaining the uptime on Windows systems.

The most practical method is perhaps to use the net statistics server command, which can be abbreviated as net stats srv:

C:\Documents and Settings\Administrator>net stats srv Server Statistics for \\SERVER Statistics since 08/22/2011 10:47 Sessions accepted 2 Automatic disconnects 41 Disconnects due to errors 110 KB sent 3656466 KB received 461755 Average response time (ms) 0 System errors 0 Permission violations 37 Password violations 0 Files accessed 95884 Communication devices accessed 0 Print jobs in queue 0 Buffers exhausted  Large buffers 0  Request buffers 0 The command completed successfully. 

We can also obtain the system uptime using the systeminfo command, which it's going to output a lot of information. To limit the output to what we need, we can use the find command. If the system is installed in English, we can search for the string Up Time:

C:\Documents and Settings\Administrador>systeminfo | find "Up Time" System Up Time: 0 Days, 3 Hours, 29 Minutes, 19 Seconds 

Posted on 16/02/2023

Categories