Retrieving the contents of colLoggedEvents==>objEvent.Message

Tech-Archive recommends: Fix windows errors by optimizing your registry



To anyone who can help. I'm trying to pull out the logon and logoff
information
from the objEvent,Message The problem is that all of the data stored in the
objEvent.Message "field" is a series of strings all separated by *vbCrLfs*,
which, of course, doesn't really lend itself to using the "split" function
(as I
found by trying it) - see example below. ("Split" desired because it builds
an array of value which can then be searched.)

Any alternative suggestions for (easily and cleanly) pull the various fields
out of objEvent.Message into a series of Array elements so that each
element can then be checked for specific elements?

All help appreciated.

David

' NOTE: all variables, Const, etc are defined earlier
Set colLoggedEvents = objWMIService.ExecQuery _
("SELECT * FROM Win32_NTLogEvent WHERE Logfile = 'Security'")
For Each objEvent in colLoggedEvents
If ((objEvent.Category = 2) or (objEvent.Category = 4 )) Then
If ( ( _
instr( 1, objEvent.User, "NETWORK SERVICE", vbTextCompare) _
OR instr( 1, objEvent.User, "SYSTEM" , vbTextCompare) _
OR instr( 1, objEvent.User, "LOCAL SERVICE" , vbTextCompare) _
OR instr( 1, objEvent.User, "ANONYMOUS" , vbTextCompare) _
) ) Then
' Do nothing --- it works fine to here...
Else
If ( objEvent.EventCode = LogOn_EventCode ) Then
' The "SPLIT" command aborts. Take it out and everything works fine
' but I don't get the information I need.
' myArray = split(objEvent.Message, vbCrLf, -1 , vbTextCompare )
' MsgBox myArray
' objTextFile.WriteLine myArray
Else
End If
End If
End If
Next


.