why does ExecQueryAsync work for XP and 2003, but not for W2K

G

Guest

I've noticed that when I try to use the "ExecQueryAsync" it doesn't seem to
work quite right in 2000. For one, the "winmgmts" process goes to about 50%
for about 5 minutes.

For some reason on W2K, it never seems to get the SINK_OnCompleted. But
this same code works great on both XP and 2003

Here is the code I'm using:

objWMIService.ExecQueryAsync objSink,"SELECT * FROM Win32_NTLogEvent WHERE
Logfile = '" & eventLog & "' AND TimeWritten >= '" & startDateArg & "' AND
TimeWritten < '" & endDateArg & "'"

objPopup = WshShell.Popup("Retrieving events", 10 ,"Event Retrieveal",
OK_BUTTON)

Sub SINK_OnCompleted(iHResult, objErrorObject, objAsyncContext)
WScript.echo "Asynchronous operation is done."
End Sub

Sub SINK_OnObjectReady(objEvent, ObjAsyncContext)
wscript.echo "Category: " & objEvent.Category
Wscript.Echo "TimeGenerated: " & objEvent.TimeGenerated
objFileWrite.WriteLine ("Category: " & objEvent.Category)
objFileWrite.WriteLine ("Computer Name: " & objEvent.ComputerName)
objFileWrite.WriteLine ("event Code: " & objEvent.EventCode)
objFileWrite.WriteLine ("message: " & objEvent.Message)
objFileWrite.WriteLine ("TimeGenerated: " & objEvent.TimeGenerated)
objFileWrite.WriteLine ("TimeWritten: " & objEvent.TimeWritten)
End Sub

Any ideas greatly appreciated
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top