Wednesday, July 6, 2011

WSH Python WMI Example using ExecNotificationQuery with __InstanceOperationEvent

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

<?xml version='1.0' encoding='iso-8859-1'?>
<script language="python">
import win32com.client
import string
locator = win32com.client.Dispatch("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'")
mystr = ""
for obj in Objs:
   for prop in Objs.Properties_:

No comments:

Post a Comment