Linked Questions

Popular Questions

I am using openssh to provide the python command to run in powershell. The python script being a UI test script tries to launch the application UI. The application starts as a background process and fails to load on the UI and hence the rest of my test script fails. I tried using paramiko, pywinrm, pypsexec, etc. All fails at the same point. I used all python packages since the CI framework is written in python and it handles reservation of machines, setting up machines and providing the above python command etc via python code.

I tried running it manually which yields the same result:

ssh myuser@<win10_machine_ip> python C:\path\to\

Is there any other way other than ssh to connect to remote windows machine UI via python code? I am stuck at this point.

a) Using winrm

import winrm
session = winrm.Session(remote_machine,
        auth=(username, password),
command = "python C:\path\to\"
command_result = session.run_ps(command)

b) Using paramiko

import paramiko
client = paramiko.SSHClient()
client.connect(host, username=username, password=password)
command = "python C:\path\to\"
stdin, stdout, stderr = ssh_client.exec_command("powershell.exe -Command {}".format(cmd))

c) Using pypsexec

from pypsexec.client import Client
c = Client("my_machine_ip", username="myuser", password="mypassword")
stdout, stderr, rc = c.run_executable("cmd.exe",
                                       arguments="/c python C:/Users/user/framework/ -d staging -s serverconnectionui_win 21581411 -i test1")

I was expecting the ui test to run without any issues

Related Questions