Get all the security groups in which an account is a direct or indirect member. The returned set does not include Distribution Groups but can include additional groups that the system would consider the user a member of for authorization purposes.
Syntax Get-ADAccountAuthorizationGroup [-Identity] ADAccount [-AuthType {Negotiate | Basic}] [-Credential PSCredential] [-Partition string] [-Server string] [CommonParameters] Key -AuthType {Negotiate | Basic} The authentication method to use: Negotiate (or 0), Basic (or 1) A Secure Sockets Layer (SSL) connection is required for Basic authentication. -Credential PSCredential The user account credentials to use to perform this task. The default credentials are those of the currently logged on user unless the cmdlet is run from an Active Directory PowerShell provider drive. If the cmdlet is run from such a provider drive, the account associated with the drive is the default. Type a user name, such as "User64" or "Domain64\User64" or specify a PSCredential object such as one generated by Get-Credential If a user name is specified, the cmdlet will prompt for a password. -Identity ADAccount An AD account object, provide one of the following values: (The identifier in parentheses is the LDAP display name for the attribute.) Distinguished Name Example: CN=JaneJacobs,CN=Users,DC=corp,DC=SS64,DC=com GUID (objectGUID) Example: 599c3d2e-f72d-4d20-8a88-030d99495f20 Security Identifier (objectSid) Example: S-1-5-21-3165297888-301567370-576410423-1103 SAM Account Name (sAMAccountName) Example: JaneJacobs The cmdlet searches the default naming context or partition to find the object. If two or more objects are found, the cmdlet returns a non-terminating error. This parameter can also get this object through the pipeline or you can set this parameter to an object instance. This example shows how to set the parameter to a distinguished name. -Identity "CN=JaneJacobs,CN=Users,DC=corp,DC=SS64,DC=com" This example shows how to set this parameter to a optional feature object instance named "accountInstance". -Identity $accountInstance -Partition string The distinguished name of an AD partition. string must be one of the naming contexts on the current directory server. The cmdlet searches this partition to find the object defined by the -Identity parameter. Examples: -Partition "CN=Configuration,DC=EUROPE,DC=TEST,DC=SS64,DC=COM" -Partition "CN=Schema,CN=Configuration,DC=EUROPE,DC=TEST,DC=SS64,DC=COM" If the -Identity parameter is set to a distinguished name, the default value of -Partition is automatically generated from this distinguished name. If running cmdlets from an AD provider drive, the default value of -Partition is automatically generated from the current path in the drive. -Server string The AD Domain Services instance to connect to, this may be a Fully qualified domain name, NetBIOS name, Fully qualified directory server name (with or without port number) CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer -OutVariable.
Get-ADAuthorizationGroup cmdlet gets the security groups from the specified user, computer or service accounts
token. This cmdlet requires a global catalog to perform the group search. If the forest that contains the account does not have a global catalog, the cmdlet returns a non-terminating error.
The -Identity parameter specifies the user, computer, or service account. You can identify a user, computer, or service account object by its distinguished name (DN), GUID, security identifier (SID), Security Account Manager (SAM)
account name or user principal name. You can also set the -Identity parameter to an account object variable, or through the pipeline. For example, you
can retrieve an account object with Get-ADUser, Get-ADComputer, Get-ADServiceAccount or Search-ADAccount
Examples
Returns all security groups for the account with SamAccountName = StewartLee
PS C:\> Get-ADAccountAuthorizationGroup StewartLee
Returns all security groups for an account with the specified Distinguished Name:
PS C:\> Get-ADAccountAuthorizationGroup "cn=StewartLee,dc=SS64Guests"
“In order to be an immaculate member of a flock of sheep, one must above all be a sheep oneself” ~ Albert Einstein
Related PowerShell Cmdlets:
Get-adPrincipalGroupMembership - Get the AD groups that have a specified user, computer, or group.