Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53553 > unrolled thread

How to execute command on remote windows machine

Started bygaurangnshah@gmail.com
First post2013-09-02 21:45 -0700
Last post2013-09-03 07:21 -0700
Articles 7 — 6 participants

Back to article view | Back to comp.lang.python


Contents

  How to execute command on remote windows machine gaurangnshah@gmail.com - 2013-09-02 21:45 -0700
    Re: How to execute command on remote windows machine Steven D'Aprano <steve@pearwood.info> - 2013-09-03 05:19 +0000
    Re: How to execute command on remote windows machine alex23 <wuwei23@gmail.com> - 2013-09-03 15:33 +1000
      Re: How to execute command on remote windows machine gaurangnshah@gmail.com - 2013-09-02 23:45 -0700
        Re: How to execute command on remote windows machine Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-09-03 22:54 -0400
    Re: How to execute command on remote windows machine random832@fastmail.us - 2013-09-03 08:39 -0400
    Re: How to execute command on remote windows machine 88888 Dihedral <dihedral88888@gmail.com> - 2013-09-03 07:21 -0700

#53553 — How to execute command on remote windows machine

Fromgaurangnshah@gmail.com
Date2013-09-02 21:45 -0700
SubjectHow to execute command on remote windows machine
Message-ID<33a44ace-33d1-493f-85cb-4f0a093368af@googlegroups.com>
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 ?

[toc] | [next] | [standalone]


#53554

FromSteven D'Aprano <steve@pearwood.info>
Date2013-09-03 05:19 +0000
Message-ID<52257151$0$2743$c3e8da3$76491128@news.astraweb.com>
In reply to#53553
On Mon, 02 Sep 2013 21:45:57 -0700, gaurangnshah wrote:

> 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



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#53555

Fromalex23 <wuwei23@gmail.com>
Date2013-09-03 15:33 +1000
Message-ID<l03sav$ufd$1@dont-email.me>
In reply to#53553
On 3/09/2013 2:45 PM, gaurangnshah@gmail.com wrote:
> 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

[toc] | [prev] | [next] | [standalone]


#53557

Fromgaurangnshah@gmail.com
Date2013-09-02 23:45 -0700
Message-ID<74ce5096-46df-42e4-ad30-fd6f5d22f40f@googlegroups.com>
In reply to#53555
Hi alex 

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

ERROR: The RPC server is unavailable.

On Tuesday, 3 September 2013 11:03:17 UTC+5:30, alex23  wrote:
> On 3/09/2013 2:45 PM, gaurangnshah@gmail.com wrote:
> 
> > 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



On Tuesday, 3 September 2013 11:03:17 UTC+5:30, alex23  wrote:
> On 3/09/2013 2:45 PM, gaurangnshah@gmail.com wrote:
> 
> > 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

[toc] | [prev] | [next] | [standalone]


#53594

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2013-09-03 22:54 -0400
Message-ID<mailman.25.1378263271.5461.python-list@python.org>
In reply to#53557
On Mon, 2 Sep 2013 23:45:38 -0700 (PDT), gaurangnshah@gmail.com declaimed
the following:

>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.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#53565

Fromrandom832@fastmail.us
Date2013-09-03 08:39 -0400
Message-ID<mailman.2.1378211961.5461.python-list@python.org>
In reply to#53553
On Tue, Sep 3, 2013, at 0:45, gaurangnshah@gmail.com wrote:
> 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.


-- 
Random832

[toc] | [prev] | [next] | [standalone]


#53568

From88888 Dihedral <dihedral88888@gmail.com>
Date2013-09-03 07:21 -0700
Message-ID<aa7d814d-9f3f-4221-ac3b-d874218fbfd4@googlegroups.com>
In reply to#53553
gauran...@gmail.com於 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 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 ?

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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web