Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import subprocess, ctypes, sys
  2.  
  3. # Make sure we run as admin
  4. def is_admin():
  5. try:
  6. return ctypes.windll.shell32.IsUserAnAdmin()
  7. except:
  8. return False
  9.  
  10. if is_admin():
  11. # Disconnect anything on M
  12. subprocess.call(r'net use m: /del', shell=True)
  13.  
  14. # Connect to shared drive, use drive letter M
  15. subprocess.call(r'net use m: \\10.0.15.40\support.private /user:ivaylo.marinov NNdredscott44', shell=True)
  16.  
  17. # Run auto installer
  18. subprocess.call(r'M:\test\vray4installer.exe -auto', shell=True)
  19.  
  20. else:
  21. # Re-run the program with admin rights
  22. ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement