Compartilhar via


AuthorizationHelper.DemandLocalAdminGroup Method (Boolean)

 

Determines whether the current thread principal is a member of the local administrator group.

Namespace:   Microsoft.WindowsServerSolutions.Common.ProviderFramework
Assembly:  ProviderFramework (in ProviderFramework.dll)

Syntax

public static bool DemandLocalAdminGroup(
    bool throwIfFailed
)
public:
static bool DemandLocalAdminGroup(
    bool throwIfFailed
)
Public Shared Function DemandLocalAdminGroup (
    throwIfFailed As Boolean
) As Boolean

Parameters

  • throwIfFailed
    Type: System.Boolean

    If this value is true, IntentionalFaultException of SecurityAccessDeniedException is thrown if the principal failed the authorization check. An argument exception is thrown for any invalid arguments regardless of this value.

Return Value

Type: System.Boolean

true if the current thread principal is a member of the local administrator group; otherwise, false.

Remarks

A principal object represents the security context of the user on whose behalf the code is running, which includes the identity of the user (IIdentity) and any roles to which they belong.

By default, the domain administrators account is a member of the built-in administrators group (S-1-5-32-544). LocalSystem is a member of the built-in administrators group, but is part of the Service group (S-1-5-6). Any service that is running under a particular user account will get the Service SID added to the access token groups.

See Also

AuthorizationHelper Class
Microsoft.WindowsServerSolutions.Common.ProviderFramework Namespace

Return to top