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

davidj411 davidj411 at gmail.com
Mon Oct 5 11:58:44 EDT 2009


import win32com.client
computer = "server"
strUser = "server\user_name"
strPassword ="my_password"
objSWbemLocator = win32com.client.Dispatch
("WbemScripting.SWbemLocator")
objSWbemServices = objSWbemLocator.ConnectServer(computer, "root
\cimv2",strUser,strPassword)
objCreateProc = objSWbemServices.Get("Win32_Process")
ProcessID  = u"200"
objCreateProc.Create(u"cabarc n c:\\temp\\test123.PY.cab c:\\temp\
\dmj.new.log",u"c:\\temp",u' ',ProcessID )

error returned:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\path\remote.process.py", line 20, in <module>
    objCreateProc.Create(u"cmd /c cabarc n c:\\temp\\test123.PY.cab c:\
\temp\\new.log",u"c:\\temp",u'',ProcessID )

what is causing this "int" error?

i have tried this with and without Unicode.
i'd like to do this without having a need to use Tim Golden's wmi
module.



More information about the Python-list mailing list