1

I am trying to execute a python script on remote machine using psexec. The python script is already on the remote machine i only want to execute it there. I am using the following command:

psexec -i -s -d \\123 -u xyz -p xyz C:/sample.py

But i get error as :

PsExec could not start C:\sample.py on 123:
The system cannot find the file  specified

I tried placing the python exe path also in the psexec comand as:

psexec -i -s -d \\123 -u xyz -p xyz C:\programs\python.exe C:/sample.py

then it opens the python.exe but does not execute the sample.py. The paths are all correct. But i am not getting why the psexec command is not able to find the script. Please suggest how shall i execute the script on the remote machine using psexec.

2 Answers 2

1

Remove the -d option from the command and provide the path in quotes and use backslash in path

Sign up to request clarification or add additional context in comments.

Comments

0

try adding " " around the exe filename

psexec -i -s -d \\123 -u xyz -p xyz "C:\programs\python.exe" C:/sample.py

if it doesn't work, try adding " " also around the parameters

psexec -i -s -d \\123 -u xyz -p xyz "C:\programs\python.exe" "C:/sample.py"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.