Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python
- __author__="Hari Priya"
- import os
- import wmi
- import shutil
- import win32wnet
- REMOTE_PATH = 'c:\\'
- def main():
- ip = '192.168.0.103'
- username = "hari"
- password = 'T!T@n1130'
- server = WindowsMachine(ip, username, password)
- '''print server.run_remote('ipconfig', async=False, output=True)'''
- class WindowsMachine:
- def __init__(self, ip, username, password, remote_path=REMOTE_PATH):
- self.ip = ip
- self.username = username
- self.password = password
- self.remote_path = remote_path
- try:
- print("Establishing connection to %s" %self.ip)
- c = wmi.WMI(privileges=["security"])
- self.connection = wmi.WMI(self.ip, user=self.username, password=self.password)
- print("Connection established")
- except wmi.x_wmi:
- print("Could not connect to machine")
- raise
- if __name__ == "__main__":
- main()
Add Comment
Please, Sign In to add comment