View Full Version : How do I find out how long a server has been up (W2K)
sirsimon
06-24-2004, 06:15 PM
Hopefully a simple request. I can't remember the DOS command that gives info on a server, including its up time. I am trying to find out when a certain server was last rebooted. Any help would be much appreciated. (IT'S DRIVING ME MAD!)
BertImmenschuh
06-25-2004, 02:29 PM
Haven't tried it on a Win2000 Server but you might look at this:
<a target="_blank" href=http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp>http://www.microsoft.com/ntserver/nts/downloads/management/uptime/default.asp</a>.
Works on my Win2000 Professional. Run it from a Command Prompt window and you can also redirect the output to a .txt file.
My .bat file up.bat:
cls
@echo off
uptime /d:04/01/2004>>uptime.txt
type uptime.txt
Everything is done in the root of C: but could be in another folder on the boot drive.
Use of the two >> symbols appends the succeeding outputs of the command to the text file.
The /d:04/01/2004 part is a beginning reference date.
*
*
*
*
<font color=blue>Good judgement comes from experience, and experience comes from bad judgement.</font color=blue> <font color=green>Experience is a wonderful thing. It enables you to recognize a mistake when you make it again.</font color=green>
crouchie1998
09-20-2004, 11:09 PM
GetTickCount is the most accurate way:
Here's another way. Create a VBS file & paste in the following code. Click it & it will tell you:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOS in colOperatingSystems
dtmBootup = objOS.LastBootUpTime
dtmLastBootupTime = WMIDateStringToDate(dtmBootup)
dtmSystemUptime = DateDiff("h", dtmLastBootUpTime, Now)
Wscript.Echo dtmSystemUptime
Next
Function WMIDateStringToDate(dtmBootup)
WMIDateStringToDate = CDate(Mid(dtmBootup, 5, 2) & "/" & _
Mid(dtmBootup, 7, 2) & "/" & Left(dtmBootup, 4) _
& " " & Mid (dtmBootup, 9, 2) & ":" & _
Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup, _
13, 2))
End Function
-------------------------------------------------------
Another way (create a VBS file & paste in the following):
Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOS in colOperatingSystems
dtmConvertedDate.Value = objOS.LastBootUpTime
dtmLastBootUpTime = dtmConvertedDate.GetVarDate
dtmSystemUptime = DateDiff("d", dtmLastBootUpTime, Now)
Wscript.Echo dtmSystemUptime
Next
chood05
02-06-2006, 10:02 AM
Type net statistics server into the command prompt. The line that says statistics since date/time is when your computer last started.
Powered by vBulletin™ Version 4.1.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.