how do i check the uptime of a windows 2003 server?

how do i check the uptime of a windows 2003 server?
Who is Participating?
MarkMichaelConnect With a Mentor Commented:
Start > Run
Type ' cmd'

use the command ' systeminfo'
At the top you will see system uptime.
Here is a script that can get all the machine names that are in a file.txt " Create a file names "Devices.txt" and put in the files in there

' declare constants
Const ForReading = 1

On Error Resume Next

'get current computer display resolution so we can position windows
Set objWMIService = GetObject("winmgmts:\\\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT PelsHeight,PelsWidth FROM Win32_DisplayConfiguration", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
     localHeight = objItem.PelsHeight
    localWidth = objItem.PelsWidth

'set up explorer progress window
Set objExplorer = WScript.CreateObject("InternetExplorer.Application")
objExplorer.Navigate "about:blank"  
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Height = 200
objExplorer.Left = (localWidth-400)/2
objExplorer.Top = (localHeight-200)/2
objExplorer.Document.Title="Uptime Audit Tool"
objExplorer.Visible = 1            

'open FSO
Set objFSO = CreateObject("Scripting.FileSystemObject")

' verify devices.txt exists
If objFSO.FileExists("devices.txt") Then
     Set objFolder = objFSO.GetFile("devices.txt")
     'display visual alert and exit script on error
     Wscript.Echo "Fatal Error: devices.txt cannot be found."
End If

' obtain device list from devices.txt
Set objDeviceFile = objFSO.OpenTextFile("devices.txt", ForReading)

'create output file
strOutputFile = "UptimeAudit.htm"
Set objAuditLog = objFSO.CreateTextFile(strOutputFile, 1)

'start writing output
objAuditLog.WriteLine "<html>"
objAuditLog.WriteLine "<head>"
objAuditLog.WriteLine "<title>Uptime Audit Report</title>"
objAuditLog.WriteLine "<meta content='Uptime Audit Report'>"
objAuditLog.WriteLine "</head>"
objAuditLog.WriteLine "<body>"

Do Until objDeviceFile.AtEndOfStream
     strComputer = objDeviceFile.Readline

    objExplorer.Document.Body.InnerHTML ="<font size=4 color=#0000FF><b>Connecting to " & strComputer & "</b></font>"
     Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv" )

     Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
     if Err.Number <> 0 Then
    objExplorer.Document.Body.InnerHTML ="<font size=4 color=#0000FF><b>Connect to " & strComputer & "failed</b></font>"    
     objAuditLog.WriteLine "<font color=#990000 size=4>Could not connect or access WMI on " & strComputer & "</font><br>"

      For Each objOS in colOperatingSystems
          dtmBootup = objOS.LastBootUpTime
          dtmLastBootupTime = WMIDateStringToDate(dtmBootup)
          dtmSystemUptime = DateDiff("n", dtmLastBootUpTime, Now)
          if dtmSystemUptime <= 1440*5 then
            objAuditLog.WriteLine "<font color=#0000FF size=4>" & strComputer & " has been down in the last five days<br>"
            objAuditLog.WriteLine "<font color=#0000FF size=4>" & strComputer & " has NOT been down in the last five days<br>"
        end if

     End If


     objAuditLog.WriteLine "</body>"
     objAuditLog.WriteLine "</html>"

     'close table and log file
     strDisplayText = "System information retrieved."
     objExplorer.Document.Body.InnerHTML = strHTMLStart & strDisplayText & strHTMLEnd


     Set objWSHShell = CreateObject("WScript.Shell")


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
Farhan KaziSystems EngineerCommented:
Click Start -> Run -> Cmd.exe
SystemInfo |FIND /I "System Up Time"
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

... or just run 'uptime' available from Microsoft at no charge -
Lee W, MVPTechnology and Business Process AdvisorCommented:
Two other methods:

1.  Check the statistics of the server or workstation service.  These services are RARELY if ever restarted, so it's generally a reliable method:

NET STATISTICS WORKSTATION or NET STATISTICS SERVER - the top line indicates when the service started.

2.  Check your event log - System Log - for source EventLog and ID 6009.  Whenever the system reboots, it logs this event.
There is also an event recorded in the System event log at 12 noon every day telling you the uptime of the system in seconds. (ID 6013) If you need to filter on events then the Event Source is simply the eventlog, or just do it on event ID.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.