Sometimes it’s useful to find out the uptime for a Windows computer. For example, if you are rebooting a whole bunch of Windows computers and you aren’t careful about keeping track of which ones you have just rebooted, you can check the uptime.
In Linux, it’s easy to find out how long a computer has been up and running. You just runtime the good ol’ uptime command. For example:
me@mycomputer:~$ uptime 09:17:32 up 23 days, 19:13, 3 users, load average: 0.36, 0.54, 0.49
In Windows, it’s almost as easy but not quite as intuitive.
The following command should work on Windows XP, Windows 2003 and perhaps other versions: net statistics server. You could also use the shorthand version of that command: net stats srv. For example:
c:\temp>net stats srv Server Statistics for \\MYCOMPUTER Statistics since 11/13/2008 1:40 PM Sessions accepted 1 Sessions timed-out 1 Sessions errored-out 1 Kilobytes sent 3734 Kilobytes received 491 Mean response time (msec) 0 System errors 0 Permission violations 0 Password violations 0 Files accessed 82 Communication devices accessed 0 Print jobs spooled 0 Times buffers exhausted Big buffers 0 Request buffers 0 The command completed successfully.
The line that starts with “Statistics since”, shows when the computer came up. That’s not quite the same as uptime but it’s close enough. Microsoft just makes you do the math (like they always do).
FOLLOW UP:
I found an even easier way getting uptime in Windows. You can use psinfo, which is part of the pstools suite of tools created by Mark Russinovich. For example:
C:\tools\pstools>psinfo \\somecomputer Uptime PsInfo v1.75 - Local and remote system information viewer Copyright (C) 2001-2007 Mark Russinovich Sysinternals - www.sysinternals.com System information for \\somecomputer: Uptime: 0 days 4 hours 7 minutes 57 seconds
If this tip helped you, please leave me a comment or send me an email!



