Select to view content in your preferred language

python library for remote execution for windows

10491
7
04-05-2014 03:07 AM
deepakT_S
Emerging Contributor
Hi All ,

I am looking for a python library for windows which will execute script/command  on remote windows machine and get back the output of script/command to my windows machine in real-time.

my windiws m/c runs windows 8
remote m/c runs windows NT 2000 server

thanks in Advance

with regards
deepakk
Tags (2)
0 Kudos
7 Replies
WilliamCraft
MVP Alum
Can you be more specific about what type of action needs to be performed on the remote Windows machine?  There are ways to run commands on a remote machine using third-party tools and sometimes using Windows batch commands; typically these require that you have Administrator privileges or Log on As Batch Job rights on the remote machine.  Are you looking to perform some Esri-related function or something different?  Please reply with some further details about what you're trying to accomplish and we'll be able to provide some more direction.
0 Kudos
deepakT_S
Emerging Contributor
Can you be more specific about what type of action needs to be performed on the remote Windows machine?  There are ways to run commands on a remote machine using third-party tools and sometimes using Windows batch commands; typically these require that you have Administrator privileges or Log on As Batch Job rights on the remote machine.  Are you looking to perform some Esri-related function or something different?  Please reply with some further details about what you're trying to accomplish and we'll be able to provide some more direction.


Hi crafty762 ,

Thanks for considering query.

Here i provide more details on my requirement .

This question is not related with Esri .

I have built a gui as shown bellow :
[ATTACH=CONFIG]32845[/ATTACH]

In the above image if , here "STATION01" is selected and right click brings up context menu , now when i select "Enable Station" , it has to execute a python script on "STATION01" (Computer name) which is remote windows m/c  and that output of specified remote script's output need to come on bottom left text area of gui , the out put needs to be real time .

with regards
Deepak
0 Kudos
WilliamCraft
MVP Alum
This forum may not be the best place to ask non-Esri question; there are many others for Python if you do some searching.  That being said, what type of command are you wanting to run on the remote Windows computer?  For example, are you trying to launch some specific process on that remote computer or obtain information about the remote computer?
0 Kudos
deepakT_S
Emerging Contributor
This forum may not be the best place to ask non-Esri question; there are many others for Python if you do some searching.  That being said, what type of command are you wanting to run on the remote Windows computer?  For example, are you trying to launch some specific process on that remote computer or obtain information about the remote computer?


Hi crafty762 ,

I agree with you, i tried over python forums and check for python liberality over internet could not find useful information. Yes i am trying to execute some python script [this are the test scripts ] which will test H/w components of motherboard and produce output.


with regards
Deepak
0 Kudos
WilliamCraft
MVP Alum
How about something like this?  I don't know if this is what you're trying to achieve by "testing" the motherboard but the script below will produce information about the remote computer's motherboard. 

import os
product = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get product').readlines()
manuf = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get manufacturer').readlines()
serial = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get serialnumber').readlines()
model = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get model').readlines()
name = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get name').readlines()
partnum = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get partnumber').readlines()
slot = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get slotlayout').readlines()
print product, manuf, serial, model, name, partnum, slot


The variable values can then be parsed and piped however you need for the remainder of your script.  Note that the WMIC commands require the use of an account which has administrative access to the remote machine (in this case, STATION01).
0 Kudos
deepakT_S
Emerging Contributor
How about something like this?  I don't know if this is what you're trying to achieve by "testing" the motherboard but the script below will produce information about the remote computer's motherboard. 

import os
product = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get product').readlines()
manuf = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get manufacturer').readlines()
serial = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get serialnumber').readlines()
model = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get model').readlines()
name = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get name').readlines()
partnum = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get partnumber').readlines()
slot = os.popen('wmic /user:"DOMAIN\USER" /password:"PASSWORD" /node:"STATION01" baseboard get slotlayout').readlines()
print product, manuf, serial, model, name, partnum, slot


The variable values can then be parsed and piped however you need for the remainder of your script.  Note that the WMIC commands require the use of an account which has administrative access to the remote machine (in this case, STATION01).



Hi crafty762 ,

I have the script say picetest.py on remote m/c which needs to be executed and output of pcietest.py need to be streamed back in real time. we need not wait for the program to complete and the output is sent.
0 Kudos
WilliamCraft
MVP Alum
The only ways I'm aware of for running scripts on a remote machine is (1) creating a scheduled task for your PY script and issuing a run task command via SCHTASKS; (2) using a third-party tool like PSEXEC; or (3) writing a PowerShell script.  I don't know of a Python library that does what you need.  Try posing your question on StackExchange.
0 Kudos