Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ConnectToRemoteWindowsMachine:
- def __init__(self, hostname, username, password):
- self.hostname = hostname
- self.username = username
- self.password = password
- # self.remote_path = hostname
- try:
- print("Establishing connection to .....%s" %self.hostname)
- connection = wmi.WMI(self.hostname, user=self.username, password=self.password)
- print("Connection established")
- except wmi.x_wmi:
- print("Could not connect to machine")
- raise
- def run_remote(self, async=False, minimized=True):
- subprocess.check_output("InstallUtil.exe "C:/Program Files/ABC/BCD/IamHere.exe"",shell=True,stderr=subprocess.STDOUT)
- except subprocess.CalledProcessError as e:
- raise RuntimeError("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))`enter code here`
- WindowsError: [Error 2] The system cannot find the file specified
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement