[python-win32] Determine admin rights
Thomas Heller
theller at ctypes.org
Wed Nov 15 21:39:30 CET 2006
Arve Knudsen schrieb:
> Hi
> Is there a way I can determine whether a user is a local administrator using
> pywin32? I've used NetUserGetLocalGroups to see if the user is in the
> "Administrators" group, but this breaks on non-English versions of Windows.
> As far as I can see there exists a function IsUserAnAdmin in shell32.lib (
> shlobj.h), would it be possible to expose this through pywin32?
>
Maybe this works?
import ctypes
print ctypes.windll.shell32.IsUserAnAdmin()
Thomas
More information about the Python-win32
mailing list