Re: Query EventLog Asynchronously
- From: "Jim Vierra" <jvierra@xxxxxxx>
- Date: Wed, 4 May 2005 00:03:25 -0400
You will have many problems with asynchronous access which is why the
default is "semi-synchronous" as opposed to full synchronous. I don't know
if there is a simple answer.
You may need to add the "Security" token.
--
Jim Vierra
"Sentinel7" <Sentinel7@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0BE2DE3B-8D87-4664-9C09-D856AB9C6DDA@xxxxxxxxxxxxxxxx
>I am using a Microsoft sample script that queries the EventLog on a server
> asynchronously. The code is:
> ---------------------------------------------------------------------
> Const POPUP_DURATION = 10
> Const OK_BUTTON = 0
>
> Set objWSHShell = Wscript.CreateObject("Wscript.Shell")
>
> strComputer = "MARIA"
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
>
> Set objSink = WScript.CreateObject("WbemScripting.SWbemSink","SINK_")
> objWMIService.ExecQueryAsync objSink, "Select * from Win32_NTLogEvent"
> Error = objWshShell.Popup("Starting event retrieval", POPUP_DURATION, _
> "Event Retrieval", 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 & " Computer Name: " &
> objEvent.ComputerName & " Event Code: " & objEvent.EventCode
> End Sub
> ---------------------------------------------------------------------
>
> This runs on against my local computer OK, however if I use the name of a
> remote machine (MARIA is the name of a Windows 2003 Server on our domain),
> I
> get back the following response:
>
> E:\WORK\EventLogMonitor\Asyncevents.vbs(11, 1) SWbemServicesEx: The RPC
> server is unavailable.
>
> I suspect this is security related, but I cannot workout how to solve the
> issue. Have searched far and wide for an answer.
>
> If I run a standard ExecQuery (semi-synchronous) against the remote
> machine,
> it works perfectly.
>
> I'd appreciate any feedback from anyone that has successfully run this
> against an up-to-date Windows 2003 Server machine.
>
> Thanks
>
> --
> Sentinel7
.
- References:
- Query EventLog Asynchronously
- From: Sentinel7
- Query EventLog Asynchronously
- Prev by Date: Re: Windows Service Monitoring & Email
- Next by Date: Re: user permissions for vbscript
- Previous by thread: Query EventLog Asynchronously
- Next by thread: user permissions for vbscript
- Index(es):