[python-win32] Check if user has windows administrator privilege

Simon Dahlbacka simon.dahlbacka at gmail.com
Mon Jan 14 20:34:50 CET 2008


>
> import ctypes
> print ctypes.windll.shell32.IsUserAnAdmin()
>
> (Courtesy of Thomas Heller - from a posting back in 2006)
>
> I have no idea if it will work on Vista. You will need to try it.
>

It kinda works on Vista. If you're running from an elevated console then it
will return 1, othervise (even if you're part of Administrators group) it
will return 0

regards,

Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080114/8eaca3f7/attachment.htm 


More information about the python-win32 mailing list