Jul24
Display the up time of a workstation or server.
on July 24, 2008 at 12:00 amPosted In: Uncategorized

Do you ever need command line access to see how long a machine has been up for? This morning I did. I needed to prove that a machine was up last night at 3 am when a critical process was going down. Someone flucked up and it sure wasn’t me! So…
Using one of my favorite command line commands NET I will show you quickly how to display your Windows up-time:
net statistics workstation
This will show you a similar screen to this:
The first line across the top shows when the machine was last rebooted along with some other geeky goodness. Do you have an easier/quicker/more obscure way of doing this?
_TheObscureAdmiN_



Discussion (14) ¬
wouldn't the event log spell that out?
if you go into a command prompt and type "systeminfo" towards the top of the information is actual update, not the date of last reboot, it'll display how long it has been!
I tried both the "net statistics workstation" and the "systeminfo" commands, but the windows that came up only stayed there for about one second and then disappeared – certainly too fast for me to read! How do I get the window to stay?
First go to the command prompt by going to start run and typing in CMD. Then at the dos prompt type in your “net statistics workstation” minus the quotes of course.
—
Thanks CJ! this method takes about 30 seconds more than net statistics workstation. @Norcross – not in plain English! You would have to go decipher it.
I use bginfo on all my servers, that way I know which machine I'm logged into. It can tell you all kinds of good stuff about the machine at a glance. http://technet.microsoft.com/en-us/sysinternals/b…“> “>http://technet.microsoft.com/en-us/sysinternals/b…
I use bginfo on all my servers, that way I know which machine I'm logged into. It can tell you all kinds of good stuff about the machine at a glance. http://technet.microsoft.com/en-us/sysinternals/b…“> “>http://technet.microsoft.com/en-us/sysinternals/b…
Anybody know an equivalent Unix command for that?
For *NIX try 'uptime', for the Win32 equivalent, go here (this is a Microsoft link) http://download.microsoft.com/download/winntsrv40…“> “>http://download.microsoft.com/download/winntsrv40… Try 'uptime /a' on your system to get a nice set of information.
For *NIX try 'uptime', for the Win32 equivalent, go here (this is a Microsoft link) http://download.microsoft.com/download/winntsrv40…“> “>http://download.microsoft.com/download/winntsrv40… Try 'uptime /a' on your system to get a nice set of information.
Many of the times listed in event logs are in the WMI time format (why they decided to use this format in the event logs I'll never know), here is a VBScript Function to convert them to a more easily readable format: <CODE> strDate = InputBox("Enter the WMI timestamp here") wscript.echo WMITimestampConvert(strDate) '#————————————————————————– '# FUNCTION…….: WMITimestampConvert() '# PURPOSE……..: Converts WMI Timestamps to a more friendly format. '# ARGUMENTS……: dtmInstallDate = The WMI timestamp to convert. '# EXAMPLE……..: strDate = InputBox("Enter the WMI timestamp here") '# wscript.echo WMITimestampConvert(strDate) '# REQUIREMENTS…: Tested on Win2k, XP, WS2003. Should work on Vista and '# WS2008. '# NOTES……….: In the example above, if you enter the WMI timestamp '# 20011120042924.000000+000 the script will return: '# 11/20/2001 4:29:24 AM (this is un UTC time, the offset '# would be different (unless you are in the UTC time '# zone). '#————————————————————————– Function WMITimestampConvert(dtmInstallDate) WMITimestampConvert = CDate(Mid(dtmInstallDate, 5, 2) & "/" &_ Mid(dtmInstallDate, 7, 2) & "/" & Left(dtmInstallDate, 4) &_ " " & Mid (dtmInstallDate, 9, 2) & ":" &_ Mid(dtmInstallDate, 11, 2) & ":" & Mid(dtmInstallDate, 13, 2)) End Function </CODE>
That’s awesome Joe! Thanks!
To check the uptime on my servers I use psinfo (from the PS Tools suite).
If you type psinfo \\servername , the output will display:(excerpt)
C:\PSTOOLS>psinfo \\servername
PsInfo v1.73 – Local and remote system information viewer
Copyright (C) 2001-2005 Mark Russinovich
Sysinternals – http://www.sysinternals.com
System information for \\servername
Uptime: 5 days 5 hours 19 minutes 42 seconds
Kernel version: Microsoft Windows Server 2003, Uniprocessor Free