Error in accessing a particular event log through SWbemLocator

Joined
Aug 5, 2009
Messages
1
Reaction score
0
I am using WMI (SWbemLocator) to access the event logs in a server. All the logs in a specified duration are being retrieved through an appropriate WQL query and their Message populated in separate notepads.

This works fine, but one particular log is repeatedly causing the code to break. It throws VB run-time error 13. Every single time, the moment this log is reached, the error occurs.

For Each objLog In colSWbemObjectSet
MsgBox (objLog.TimeWritten)
MsgBox (objLog.Message)
Next

Now if I put a comment (') for the 2nd Msgbox, it works fine while scanning this particular log.

It is a very simple log. It has some simple strings, some " characters and a XML line. There is no other special character.
I was wondering if this is causing any VB related problem. I put the exact log contents in a notepad in my local desktop and wrote a VBScript code to do the same things as the VBScript in the WMI code does. There was no problem, there should not be any VBScript related problem here. What might be going wrong?
 
Back
Top