WMI remote call in python script to create process on remote windows computer

David Jackson davidj411 at gmail.com
Wed Oct 7 17:34:24 EDT 2009


ok, cut and pasted, but changed the username/password to protect the innocent.
this is from interactive prompt.
let me know if i am still not doing the slashes correctly please.
i doubt authentication is the issue.; i can get pid information using
WQL queries.
objCreateProc.Create expects 4 strings (not objects?), right?

version info:
>>> sys.version
'2.6 (r26:66721, Oct  2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)]'

>>> import win32com.client
>>> computer = "servername"
>>> strUser = "servername\\my_account"
>>> strPassword ="shh_secret"
>>> objSWbemLocator = win32com.client.Dispatch("WbemScripting.SWbemLocator")
>>> objSWbemServices = objSWbemLocator.ConnectServer(computer, r"root\cimv2",strUser,strPassword)
>>> objCreateProc = objSWbemServices.Get("Win32_Process")
>>> ProcessID  = u"200"
>>> objCreateProc.Create(u"cmd /c ping 127.0.0.1 >>c:\\temp\\finall.log",u"c:\\temp",u' ',ProcessID )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable


how can i see the method available?
>>> help(objCreateProc) just gives me "Help on instance of CDispatch in module win32com.client:"

Thanks
David



More information about the Python-list mailing list