How to execute python script on remote with python way..?


 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions How to execute python script on remote with python way..?
# 1  
Old 12-14-2018
How to execute python script on remote with python way..?

Hi all,

I am trying to run below python code for connecting remote windows machine from unix to run an python file exist on that remote windows machine..

Below is the code I am trying:

Code:
#!/usr/bin/env python
import wmi

c = wmi.WMI("xxxxx", user="xxxx", password="xxxxxxx")
process_startup = c.Win32_ProcessStartup.new()
process_id, result = c.Win32_Process.Create(CommandLine="C:\Python27\abtest.py")
if result == 0:
  print("Process started successfully: %d" % process_id)
print(result)

connection is established successfully. But its not executing the python script..
if i had to do it manually then on remote i will got c:\phhton27 manually then run at prompt like below
Code:
c:/python27> python abtest.py

How can I put above command in .Win32_Process.Create format ?

Please guide.
# 2  
Old 12-14-2018
Hmm... These are UNIX and Linux Q&A forums.

You have a Windows issue, so I'm moving this question over to the Windows forum.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

Create a C source and compile inside Python 1.4.0 to 3.7.0 in Python for ALL? platforms...

Hi all... As you know I like making code backwards compatible for as many platforms as possible. This Python script was in fact dedicated for the AMIGA A1200 using Pythons 1.4.0, 1.5.2, 1.6.0, 2.0.1, and 2.4.6 as that is all we have for varying levels of upgrades from a HDD and 4MB FastRam... (1 Reply)
Discussion started by: wisecracker
1 Replies

2. Shell Programming and Scripting

Trying to loop through folders and execute an existing python script.

I am trying to loop through lots and lots of folders and use the names of the folders to run a Python script which has parameters. E.g. -- setup_refs -n John -f England/London/Hackney/John -c con/con.cnf Normally to run `setup_refs` once from command line it's: `python setup_refs.py -n John... (3 Replies)
Discussion started by: Mr_Keystrokes
3 Replies

3. Shell Programming and Scripting

Execute python file, FTP output to another server

Greetings all, We are implementing a new tool called URLwatch which is a python utility. Here are the requirements. 1) Run every 10 seconds 2) Execute the python script 3) Output file gets generated, FTP it to a differernt server I gave no idea how to do this and management needs a demo... (3 Replies)
Discussion started by: jeffs42885
3 Replies

4. Shell Programming and Scripting

**python** unable to read the background color in python

I am working on requirement on spreadsheet in python scripting. I have a spreadsheet containing cell values and with background color. I am able to read the value value but unable to get the background color of that particular cell. Actually my requirement is to read the cell value along... (1 Reply)
Discussion started by: giridhar276
1 Replies

5. SuSE

"ssh suse-server 'python -V' > python-version.out" not redirecting

Okay, so I have had this problem on openSUSE, and Debian systems now and I am hoping for a little help. I think it has something to do with Python but I couldn't find a proper Python area here. I am trying to redirect the output of "ssh suse-server 'python -V'" to a file. It seems that no matter... (3 Replies)
Discussion started by: Druonysus
3 Replies

6. Shell Programming and Scripting

Need a Python script

I work on various messages received from server and want to write a python script that can sort messages with unique flag values and give me the output in a text file. I get these messages in the form of .zcap file from server, in order to get messages from those files; I use an internal tool:... (0 Replies)
Discussion started by: Vijeta Laad
0 Replies

7. Programming

Python Script with C++Qt

Hi i work under CentOS 5.5, Qt 4.7, Python 2.4. i need to send data from C++ to Python. i write a code but it's not work, i have an Inferior System error on it. PyObject* objArg = Py_BuildValue("(z)", cKeyNum); PyObject* objFunc = (PyObject*)Init; pValue = PyEval_CallObject(objFunc, objArg);... (12 Replies)
Discussion started by: HanyM.Magdy
12 Replies

8. Programming

Python: bash-shell-like less functionality in the python shell

Hello, Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells? Example: >>> import subprocess >>> help(subprocess) ... ... I'm hoping so as I hate scrolling and love how less works with... (0 Replies)
Discussion started by: Narnie
0 Replies
Login or Register to Ask a Question