I want to execute a Python script as Administrator. I'm using the following command to do so:
powershell Start-Process python -ArgumentList "C:\Users\myuser\python_script.py","-param1", "param1","-param2","param2" -Verb "runAs"
This command works fine if I'm using traditional SSH using a terminal. Target machine is Windows RS4 and I'm using the new native SSH server available since RS3.
My client's Python code is:
import paramiko
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect(hostname=myhost, username=myuser, password='trio_012')
stdin, stdout, stderror = ssh_client.exec_command("powershell Start-Process python -ArgumentList \"C:\Users\myuser\python_script.py\",\"-param1\", \"param1\",\"-param2\",\"param2\" -Verb \"runAs\"")
print 'stdout:', stdout.readlines()
print 'stderror:', stderror.readlines()
The output I'm getting:
stdout: []
stderror: []
I don't see the script is running on the other side and it seems like nothing happens. I don't know what is the problem cause I'm getting no output.
I'm using Paramiko 1.18.5 (I can't use the new v2, I'm having issues with known_hosts
file and Windows when using paramiko.AutoAddPolicy()
policy)