Tuesday, July 5, 2011

Ruby WMI Example using ExecNotificationQuery with __InstanceOperationEvent

You can download the scripting program for generating these scripts at:

http://www.planetmps.com/wmiscriptsENQ_O.html

require("win32ole")
i=0
locator = WIN32OLE.new("WbemScripting.SWbemLocator")
svc = locator.connectserver()
svc.Security_.AuthenticationLevel = 0
svc.Security_.ImpersonationLevel = 3
objs = svc.ExecNotificationQuery("Select * From __InstanceOperationEvent WITHIN 1 where targetInstance ISA 'Win32_Process'")
tstr = ""
objs.each{ |obj|
    obj.Properties_.each{ |prop|

End
End

No comments:

Post a Comment