Execute a command on remote machine in python

Martin P. Hellwig martin.hellwig at gmail.com
Tue Nov 15 08:29:23 EST 2011


On 11/15/11 12:04, Roark wrote:
> Hi,
>
> I am first time trying my hands on python scripting and would need
> some guidance from the experts on my problem.
>
> I want to execute a windows command within python script from a client
> machine on a remote target server, and would want the output of the
> command written in a file on client machine. What is the way it could
> be achieved.
>

If your doing windows to windows then you could wrap PsExec 
(sysinternals) or the open source but more or less abandoned RemCom 
(http://sourceforge.net/projects/rce).

Disadvantage is that both of them are a royal PITA to wrap nicely.
There are multiple problems with re-redirected STDOUT/STDERR

Advantage is that you don't need to configure anything on the target 
machine.

hth
-- 
mph





More information about the Python-list mailing list