Link to home
Start Free TrialLog in
Avatar of Calv1n
Calv1n

asked on

Checking Windows Server 2003 Reboot in Event Viewer

How can you tell that a server has been rebooted in Windows 2003 Server? Can you tell in Event Viewer? Or is their a better way? Thanks.

-Brian
Avatar of Jay_Jay70
Jay_Jay70
Flag of Australia image

event viewer is the best way, just look for when the services all give a successful start
Yeah, You can check event view and there is information like when DHCP entered the running state ect..

Or you could Open Notepad.  Paste the Below Code in.  Save it as uptime.vbs - Now double click the file.  This file will tell you how many hours the computer has been running for since last reboot.

' Check for computers last reboot
 
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")

Dim uptime
 
For Each objOS in colOperatingSystems
    dtmBootup = objOS.LastBootUpTime
    dtmLastBootupTime = WMIDateStringToDate(dtmBootup)
    dtmSystemUptime = DateDiff("h", dtmLastBootUpTime, Now)
    uptime = 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

WScript.Echo uptime
ASKER CERTIFIED SOLUTION
Avatar of davino_1
davino_1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial