run exe on different computer

Dave Angel davea at
Sun Sep 13 13:17:26 CEST 2009

daved170 wrote:
> Hi everybody,
> I'm building a small python program that run a service (exe file) on
> my servers.
> I don't want to use remote desktop and it's siblings.
> I would like to have some information on how to run an exe on a
> different computer and if there a way to check if that exe is still
> alive.
> Thanks
> Dave
On a question like this, you really need to supply much more information 
on your constraints.  You could start by saying these servers are 
running Windows Server 2003.  And that they're on a domain (rather than 
a workgroup).  And that you're trying to access them from another 
machine within the same local domain, not over the internet.  And that 
your local machine is on the same domain, and has an account with admin 
privileges for all the desired servers.  And that you are allowed to do 
a one-time install (of something) on each server prior to this 
particular need.  And that each server already has Python version 2.5 
installed, and the IT department won't allow you to install any later 

Then once you have an environment, you need to specify just what kind of 
program you want to run on those servers.  Is it an EXE program?  Or is 
it Python, with a particular script?  Does it really need to be a 
*service*, which has a particular set of constraints, and should be 
installed, and started/stopped using the service manager.  Do you want 
this program to restart whenever the servers are restarted?

One solution that should work for nearly every Windows topology might be 
to go to each server, run the scheduler task, and specify a new batch 
file to be run upon boot.  This batch file can check a specified 
(shared) directory for a python script, and if found, run it.  If not 
found, sleep for 60 seconds or so, then repeat.  Note that it's a good 
idea to put a five minute delay at the very beginning, in case the 
script needs to be deleted at the next boot.  Sometimes a bug requires 
surgery, and it's good to have enough time to do it.

Now, to control those servers from another machine, copy an appropriate 
script into the prearranged directory.  Within a minute, it'll be 
running, and it can post whatever results it likes in another accessible 

Whether this is a "safe" thing to do is a separate question.  Generally 
an IT department likes to have some control over just what programs run 
on their servers, and for good reason.


More information about the Python-list mailing list