Error in accessing a particular event log through SWbemLocator

Tech-Archive recommends: Speed Up your PC by fixing your registry




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?
.



Relevant Pages

  • Re: tools
    ... First, WMI has nothing to ... do with VBScript directly. ... to the SDK are broken. ... The original help file, if you can find it, will be named ...
    (microsoft.public.scripting.vbscript)
  • RE: VBA API Default printer
    ... it uses WMI Win32_Printer class: ... Set colInstalledPrinters = objWMIService.ExecQuery _ ... MsgBox "default printer is " & strPrinterName ...
    (microsoft.public.excel.programming)
  • Re: Good WSH Book
    ... I have that book and a similarly titled one on VBScript (both from Wrox ... WSH "API" and very little has changed since ... WMI is another issue. ...
    (microsoft.public.scripting.wsh)
  • RE: Obtain share from dfs link
    ... and noticed we can enumerate DFSNodes/DFSTarget via ... WMI. ... [Scripting DFS Storage using VBScript] ...
    (microsoft.public.scripting.vbscript)
  • Re: VB application calling services on W2k3
    ... For Each ntService In objcol ... MsgBox "You do not have permission on this computer" ... Have you checked whether or not WMI is permitted on the 2003 machine? ...
    (microsoft.public.vb.general.discussion)