Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

VBScript - Anyone with experience creating permanent event subscriptions (e.g. ActiveScriptEventConsumer) using an asynchronous __EventFilter?

$
0
0

I am trying to move a temporary event subscription to a permanent event subscription but am unable to wrap my head around how to configure the "ActiveScriptEventConsumer" and the "__EventFilter" classes to make this work with an async operation. 

In my temporary event subscription (e.g. my vbscript), I use the standard:

Set objSink = WSCript.CreateObject("WbemScripting.SWbemSink","SINK_")
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
objWMI.ExecNotificationQueryAsync objSink, "SELECT * FROM __InstanceCreationEvent WITHIN 600 WHERE TargetInstance ISA 'Win32_NTLogEvent' AND TargetInstance.LogFile = 'System'"

but in the permanent event subscription, the WQL in the __EventFilter class doesn't allow me to define an SWbemSink object so I'm not sure how to configure it for Async operations.  Also, because the script processor isn't done via the standard engines, the WScript object isn't available to even create an SWbemSink object. 

So I guess my questions really are, does anyone know how to set up an async permanent event subscription to Win32_NTLogEvent or Win32_Service?  If so, what does the Query property on the __EventFilter class look like and then using an ActiveScriptEventConsumer as the permanent consumer, what does the ScriptText property look like to be able to recieve the async events from the filter?  Thx.




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>