Click or drag to resize

UserAccountControlIsUserInAdminGroup Method

The function checks whether the object associated with the access token belongs to a user account that is a member of the local Administrators group, even if it currently is not elevated.

Namespace:  TomsToolbox.Desktop
Assembly:  TomsToolbox.Desktop (in TomsToolbox.Desktop.dll)
Syntax
public static bool IsUserInAdminGroup(
	SafeTokenHandle userToken
)

Parameters

userToken
Type: TomsToolbox.DesktopSafeTokenHandle
The user token.

Return Value

Type: Boolean
Returns true if the object associated with the access token belongs to user account that is a member of the local Administrators group. Returns false if the token does not.
Exceptions
ExceptionCondition
Win32Exception
Win32ExceptionWhen any native Windows API call fails, the function throws a Win32Exception with the last error code.
See Also