Execute a command on remote machine in python

Marco Nawijn nawijn at gmail.com
Tue Nov 15 08:54:14 EST 2011


On Nov 15, 1:04 pm, Roark <suha... at gmail.com> 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.
>
> Thanks in advance,
> Roark.


Hello Roark,

If the command does not change over time, an option could be to
encapsulate the command and the output behind an XML-RPC interface. I
used it several times now and for me this works perfectly. XML-RPC is
part of the Python standard library, so it should work out of the box
on windows and linux. It also supports mixed programming languages
(maybe C# on windows to get the info you want and python on linux on
the client).

Kind regards,

Marco



More information about the Python-list mailing list