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

Graeme Glass graemeglass at gmail.com
Mon Jan 14 20:29:39 CET 2008


On Jan 14, 2008 8:55 PM, Patrick Li <patrick at gxlinc.com> wrote:

> Hi,
>
> Does anyone know if there's a way to programmatically check to see if a
> user has windows administrator privilege?  I need this to work in WinXP and
> Vista.
>
> Thanks in advance,
> Patrick
>
>
> _______________________________________________
>


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.

hth,

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


More information about the python-win32 mailing list