The situation: I am running psexec.exe from one windows machine to another and would like to run a python script on the remote machine and look at the output of the script without having to pipe it to a file and then read out the file, because the script is actually interactive and needs to have user input and display results back to the user for real time decisions. Running psexec in it's current form does not display anything when a python script is ran. example:
C:\Users\rweber\Desktop\PSEXEX>PsExec.exe \dcn0 -u administrator -p password C:\Python26\python.exe gives no stdin,stdout,stderr or access to the python console. It will just sit there until exited. Can this be fixed? How do you fix it?

  • ps... running python 2.6 on both. – Rusty Weber Apr 9 '13 at 17:52
  • pps. piping the command to a batch file and then running it still does not give me the stdout/stderr of any python script let alone stdin for a script. – Rusty Weber Apr 9 '13 at 18:07
  • PPPS. problem with psexec extends to other shell type interfaces that spawn another process. These processes are normally monitered by the cmd window that spawned them when ran locally, but running the cmd prompt remotely does not forward the stdout/err/in between the remote cmd window and the spawned process. other examples: perl, ssh. – Rusty Weber Apr 9 '13 at 20:05

Trying to shell out to a poorly written solution that has lots of overhead is messy, hard, and not ideal. Utilizing the windows remote management suite is a much cleaner solution and native to python using the : https://github.com/diyan/pywinrm project.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.