How to execute command on remote windows machine

G

gaurangnshah

Hi Guys,

I have a requirement where i need to kill one process on remote windows machine.
Following command just works fine if i have to kill process on local machine

os.system('taskkill /f /im processName.exe')

However I am not able to figure out how to execute this command on remote windows machine.

Note: my local machine is also windows (machine from where i have to execute command)

so is there any way i can execute command from windows machine on remote windows machine ?
 
S

Steven D'Aprano

so is there any way i can execute command from windows machine on remote
windows machine ?

You are looking for information on "Remote Procedure Calls", or RPC.

There are obvious security implementations from enabling RPC, imagine if
random people on the internet could shut down whichever processes they
like on your machine. But having said that, there are a number of
excellent RPC libraries for Python. Here are two I have (briefly) used:

http://pythonhosted.org/Pyro4/

https://pypi.python.org/pypi/rpyc
 
A

alex23

I have a requirement where i need to kill one process on remote windows machine.
Following command just works fine if i have to kill process on local machine

os.system('taskkill /f /im processName.exe')

However I am not able to figure out how to execute this command on remote windows machine.

The simplest way is from your local machine. taskkill accepts a /s
parameter which can specify a remote machine by IP or name.

http://technet.microsoft.com/en-us/library/bb491009.aspx
 
G

gaurangnshah

Hi alex

I tried the command you suggested however it is giving me following error.

ERROR: The RPC server is unavailable.
 
R

random832

Hi Guys,

I have a requirement where i need to kill one process on remote windows
machine.
Following command just works fine if i have to kill process on local
machine

os.system('taskkill /f /im processName.exe')

However I am not able to figure out how to execute this command on remote
windows machine.

Note: my local machine is also windows (machine from where i have to
execute command)

so is there any way i can execute command from windows machine on remote
windows machine ?

The taskkill command actually has an option for this: /S. I don't know
what mechanism it uses or what you would have to do to give yourself
permission to use it.
 
8

88888 Dihedral

(e-mail address removed)æ–¼ 2013å¹´9月3日星期二UTC+8下åˆ12時45分57秒寫é“:
Hi Guys,



I have a requirement where i need to kill one process on remote windows machine.

Following command just works fine if i have to kill process on local machine



os.system('taskkill /f /im processName.exe')



However I am not able to figure out how to execute this command on remotewindows machine.



Note: my local machine is also windows (machine from where i have to execute command)



so is there any way i can execute command from windows machine on remote windows machine ?

This is trivial. First install the VNC on the remote site and
make sure your VNC is working in the proper forground.

Just write a mouse/keyboard emulator service on the remote site
with the propper port opened by python scripts.

Use the control computer to send commands to the remote site.

This scheme will work under unix-linux-windows OS.
 
D

Dennis Lee Bieber

Hi alex

I tried the command you suggested however it is giving me following error.

ERROR: The RPC server is unavailable.

Which basically means that the remote machine has been secured -- by
having the RPC system disabled from access by other machines.

Consider, os.system() can only perform commands you can execute from
Windows console (command) shell. So until you come up with a command you
can enter at a "DOS Prompt" and have it work, you can ignore doing it with
Python.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top