Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Python Get Admin Privilege

import traceback,ctypes,sys
def isa():
try:
if ctypes.windll.shell32.IsUserAnAdmin():return True
except Exception as e:
print(e)
traceback.print_exc()
return False
elev=0
def admin():
global bkz,elev
if isa():return True
bkz=None
elev=1
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, 0, 1)
if admin():
...code...


This post first appeared on SMARTMANOJ, please read the originial post: here

Share the post

Python Get Admin Privilege

×

Subscribe to Smartmanoj

Get updates delivered right to your inbox!

Thank you for your subscription

×