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

Tim Golden mail at timgolden.me.uk
Tue Oct 6 10:48:58 CEST 2009

davidj411 wrote:
> 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?

Not clear which "int" error you mean, but trying to help anyway...

You need to use raw strings (or use double-backslashes). That
may or may not be the cause of your problems, but it certainly
won't help. You may also run into theoretical restrictions of
what remote WMI processes can achieve (no desktop/windowstation etc.).

> 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.

To ask the obvious question: why? I'm not offended, just curious :)


More information about the Python-list mailing list