A vbsript like this should work (this is set for uptime over an hour):

strComputer = "."
Set objShell = Wscript.CreateObject("Wscript.Shell")
Set objWMIService = GetObject _
    ("winmgmts:\\" & 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
        If dtmSystemUptime > 1 then
                objShell.LogEvent EVENT_SUCCESS, _
                    "Event info to write to EventLog..."
        End If
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

Jeff

From: Craig Gauss [mailto:gau...@rhahealthcare.org] 
Sent: Monday, November 02, 2009 8:53 AM
To: NT System Admin Issues
Subject: System Uptime and event log

Does anyone know of any sort of script that would check the System Uptime and 
if it is over a certain amount of time it would register an event in the Event 
Log?  
 
 
Craig Gauss,  Technical Supervisor/Security Officer
Riverview Hospital Association
 
 

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to