Windows – is there a way to get PSEXEC to output the results of python

networkingpstoolspythonwindows

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?

Best Answer

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.

IT'S MUCH CLEANER AND I AM MUCH HAPPIER WITH THE EASE OF RESULTS!