kor Posted June 4, 2012 Share Posted June 4, 2012 I do not need to write anything to the event log, but I need to search the "Application" portion for a particular event. I also need to know if that event is an information, a warning, or an error. So I guess I need to search for the event ID, and the status of the event. Even better if I can also parse the description field. Is this possible? Link to comment Share on other sites More sharing options...
hannes08 Posted June 4, 2012 Share Posted June 4, 2012 You can use WMI to query the event logs. You can even parse the description! VB code: strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!" _ & strComputer & "rootcimv2") Set colLoggedEvents = objWMIService.ExecQuery _ ("Select * from Win32_NTLogEvent " _ & "Where Logfile = 'System'") For Each objEvent in colLoggedEvents Wscript.Echo "Category: " & objEvent.Category & VBNewLine _ & "Computer Name: " & objEvent.ComputerName & VBNewLine _ & "Event Code: " & objEvent.EventCode & VBNewLine _ & "Message: " & objEvent.Message & VBNewLine _ & "Record Number: " & objEvent.RecordNumber & VBNewLine _ & "Source Name: " & objEvent.SourceName & VBNewLine _ & "Time Written: " & objEvent.TimeWritten & VBNewLine _ & "Event Type: " & objEvent.Type & VBNewLine _ & "User: " & objEvent.User Next VB code can easily be transfered to AutoIt! MariusN 1 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now