WMI remote call in python script to create process on remote windows computer
davea at ieee.org
Tue Oct 6 12:29:11 CEST 2009
> import win32com.client
> computer = "server"
> strUser = "server\user_name"
> strPassword ="my_password"
> objSWbemLocator = win32com.client.Dispatch
> objSWbemServices = objSWbemLocator.ConnectServer(computer, "root
> 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
As Tim says, you need to double your backslashes. You have several
places where they are not properly escaped. Alternatively, at least in
all these cases, you could use the raw strings.
But the real problem with your message would seem to be that you retyped
the material, with typos. And didn't include the entire error message.
Copy/paste are your friend. And in case you don't know how to do that
from a Windows console window, just ask. Or try Right-click on the
title bar for some ideas.
I don't have specific answers for you -- I don't currently do remote
stuff this way. But you'll get better answers if you try the above.
More information about the Python-list