siddhartha veedaluru wrote:
I need to run a command on remote machine (may be in another domain also)
and get the output and return code of that command or exe.
Also i need to copy file to remote machine.?
Can i achive it through wmi
I would suggest that WMI -- flexible as it undoubtedly is -- is not really
the vehicle for this kind of thing. Yes, you can run commands and get the
result:
<code>
import wmi
c = wmi.WMI () # specify other machine
pid, result = c.Win32_Process.Create (r'cmd /c dir > %TEMP%\dir.log')
</code>
but WMI isn't, of itself, a file transport mechanism. If any file-sharing
mechanism exists between the machines in question (SMB, FTP or whatever)
then there's nothing to stop you from using WMI, either via
Win32_Process.Create or via CIM_DataFile.Copy. But the only advantage
this offers over simply shelling is that you can run from the remote machine,
effectively "pulling", say, admin files from a central admin server with appropriate
credentials, rather than "pushing" out to every other machine.
TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32