Wednesday, July 6, 2011

WSH Python WMI Example using ExecQuery

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

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

<?xml version='1.0' encoding='iso-8859-1'?>
<package>
<job>
<script language="python">
<![CDATA[
import win32com.client
import string
locator = win32com.client.Dispatch("WbemScripting.SWbemLocator")
svc = locator.ConnectServer()
svc.Security_.AuthenticationLevel = 0
svc.Security_.ImpersonationLevel = 3
objs = svc.ExecQuery("Select * From Win32_Process")
mystr = ""
for obj in Objs:
   for prop in Objs.Properties_:
  
  
   break
  
]]>
</script>
</job>
</package>

No comments:

Post a Comment