There is a very useful Windows command that Microsoft didn’t include in any version of windows but should have. This is the uptime command. There is a knowledge base article here. It was released back in the Windows NT days, but still works on all current versions of windows. I have found this to be an easy way to find out the uptime of the windows servers I maintain without have to log on to the box.
To install just download uptime.exe and place it in the windows directory. Then run it from the command line.
uptime /? will give a listing of all the options and uptime /help will give detailed instructions.
UPTIME, Version 1.01 (C) Copyright 1999, Microsoft Corporation
Uptime [server] [/s ] [/a] [/d:mm/dd/yyyy | /p:n] [/heartbeat] [/? | /help] server Name or IP address of remote server to process. /s Display key system events and statistics. /a Display application failure events (assumes /s). /d: Only calculate for events after mm/dd/yyyy. /p: Only calculate for events in the previous n days. /heartbeat Turn on/off the system’s heartbeat /? Basic usage. /help Additional usage information.
Uptime works by checking the windows event logs for startup and shutdown times. Running uptime with the /s switch will provide more detailed statistics as shown below. If the event log has been cleared or is corrupted uptime will not show correct stats.
I have found it helpful to set up .bat files with the servers I want to check. This then gives me a quick list of the uptime of various servers. It is quite a useful command. I’m not sure why microsoft didn’t just stick it in the directory with all their other commands.
C:\uptime \\myserver -s
Uptime Report for: \\myserver
Current OS: Microsoft Windows Server 2003, Service Pack 2, Multiprocessor Free. Time Zone: Eastern Daylight Time
System Events as of 6/6/2008 9:59:47 AM:
Date: Time: Event: Comment: ---------- ----------- ------------------- -----------------------------------
12/2/2007 1:18:11 PM Shutdown 12/2/2007 1:20:14 PM Boot Prior downtime:0d 0h:2m:3s 12/4/2007 10:45:19 PM Shutdown Prior uptime:2d 9h:25m:5s 12/4/2007 10:47:23 PM Boot Prior downtime:0d 0h:2m:4s 12/16/2007 9:23:16 PM Shutdown Prior uptime:11d 22h:35m:53s 12/16/2007 9:25:30 PM Boot Prior downtime:0d 0h:2m:14s 3/1/2008 10:51:12 PM Shutdown Prior uptime:76d 1h:25m:42s 3/1/2008 10:54:05 PM Boot Prior downtime:0d 0h:2m:53s 3/16/2008 5:04:48 PM Shutdown Prior uptime:14d 17h:10m:43s 3/16/2008 5:07:07 PM Boot Prior downtime:0d 0h:2m:19s 4/9/2008 7:00:38 PM Shutdown Prior uptime:24d 1h:53m:31s 4/9/2008 7:02:47 PM Boot Prior downtime:0d 0h:2m:9s 4/9/2008 7:23:35 PM Shutdown Prior uptime:0d 0h:20m:48s 4/9/2008 7:25:47 PM Boot Prior downtime:0d 0h:2m:12s
Current System Uptime: 57 day(s), 14 hour(s), 34 minute(s), 44 second(s)
--------------------------------------------------------------------------------
Since 12/2/2007:
System Availability: 99.9941% Total Uptime: 186d 19h:25m:42s Total Downtime: 0d 0h:15m:54s Total Reboots: 7 Mean Time Between Reboots: 26.69 days Total Bluescreens: 0
Yeah, the example outputs here are a bit wider than my blog theme. I am hoping to roll out a new theme which will be wider, but since I am not a designer or good with css at all, it could be a while.