[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 16799
  • Last Modified:

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

how do i check the uptime of a windows 2003 server?
0
go95
Asked:
go95
1 Solution
 
MarkMichaelCommented:
Start > Run
Type ' cmd'

use the command ' systeminfo'
At the top you will see system uptime.
0
 
bsharathCommented:
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:\\127.0.0.1\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
Next

'set up explorer progress window
Set objExplorer = WScript.CreateObject("InternetExplorer.Application")
objExplorer.Navigate "about:blank"  
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width=400
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")
Else
     'display visual alert and exit script on error
     Wscript.Echo "Fatal Error: devices.txt cannot be found."
     Wscript.Quit(1)
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
     boolAbort=False
     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>"

          else
         
      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>"
          else
            objAuditLog.WriteLine "<font color=#0000FF size=4>" & strComputer & " has NOT been down in the last five days<br>"
        end if
       Next

     End If

     Loop

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

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

objExplorer.Quit

     Set objWSHShell = CreateObject("WScript.Shell")
     objWSHShell.Run(strOutputFile)

Wscript.Quit(1)

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
0
 
Farhan KaziSystems EngineerCommented:
Click Start -> Run -> Cmd.exe
SystemInfo |FIND /I "System Up Time"
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
MSE-dwellsCommented:
... or just run 'uptime' available from Microsoft at no charge -

http://support.microsoft.com/kb/232243
0
 
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.
0
 
tigermattCommented:
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.

-tigermatt
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now