Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. class ConnectToRemoteWindowsMachine:
  2. def __init__(self, hostname, username, password):
  3. self.hostname = hostname
  4. self.username = username
  5. self.password = password
  6. # self.remote_path = hostname
  7. try:
  8. print("Establishing connection to .....%s" %self.hostname)
  9. connection = wmi.WMI(self.hostname, user=self.username, password=self.password)
  10. print("Connection established")
  11. except wmi.x_wmi:
  12. print("Could not connect to machine")
  13. raise
  14.  
  15. def run_remote(self, async=False, minimized=True):
  16.  
  17. subprocess.check_output("InstallUtil.exe "C:/Program Files/ABC/BCD/IamHere.exe"",shell=True,stderr=subprocess.STDOUT)
  18.  
  19. except subprocess.CalledProcessError as e:
  20. raise RuntimeError("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))`enter code here`
  21.  
  22. WindowsError: [Error 2] The system cannot find the file specified
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement