< Back
Get-ActiveDirectoryGroupMembership
Post
NAME Get-ActiveDirectoryGroupMembership
SYNOPSIS
Get the groups an Active Directory object is a member of.
SYNTAX
Get-ActiveDirectoryGroupMembership [-Identity] <String> [-Recurse] [<CommonParameters>]
DESCRIPTION
Get the groups an Active Directory object is a member of having the option to include
all the groups (including groups that are nested).
PARAMETERS
-Identity <String>
The object to check it's membership
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false
-Recurse [<SwitchParameter>]
Recursive query
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-ActiveDirectoryGroupMembership -Identity "CN=Christos Polydorou,CN=Users,DC=lab,DC=local"
DistinguishedName GroupCategory GroupScope Name
ObjectClass ObjectGUID SamAccountName SID
----------------- ------------- ---------- ----
----------- ---------- -------------- ---
CN=Test Group 1 Nested,OU=Tes... Security Global Test Group 1
Nested group 326195ba-2d8b-40f0-8a39-1c08... Test Group 1 Nested
S-1-5-21-3554682577-58629175...
The user is a direct member of the group "Test Group 1 Nested" only.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-ActiveDirectoryGroupMembership -Identity "CN=Christos Polydorou,CN=Users,DC=lab,DC=local" -Recurse
DistinguishedName GroupCategory GroupScope Name
ObjectClass ObjectGUID SamAccountName SID
----------------- ------------- ---------- ----
----------- ---------- -------------- ---
CN=Test Group 1 Parent,OU=Tes... Security Global Test Group 1
Parent group d19916ff-106a-49c4-9aa6-78fa... Test Group 1 Parent
S-1-5-21-3554682577-58629175...
CN=Test Group 1,OU=Test_OU,DC... Security Global Test Group 1
group 9c11c15f-d4e5-4afe-9f1a-06db... Test Group 1
S-1-5-21-3554682577-58629175...
CN=Test Group 1 Nested,OU=Tes... Security Global Test Group 1
Nested group 326195ba-2d8b-40f0-8a39-1c08... Test Group 1 Nested
S-1-5-21-3554682577-58629175...
The user is a direct member of the group "Test Group 1 Nested" only. The "Test Group 1 Nested" is a member of
"Test Group 1" which in turn is a member of "Test Group 1 Parent". Thus the user is concidered a member of all
groups
RELATED LINKS
SYNOPSIS
Get the groups an Active Directory object is a member of.
SYNTAX
Get-ActiveDirectoryGroupMembership [-Identity] <String> [-Recurse] [<CommonParameters>]
DESCRIPTION
Get the groups an Active Directory object is a member of having the option to include
all the groups (including groups that are nested).
PARAMETERS
-Identity <String>
The object to check it's membership
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false
-Recurse [<SwitchParameter>]
Recursive query
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-ActiveDirectoryGroupMembership -Identity "CN=Christos Polydorou,CN=Users,DC=lab,DC=local"
DistinguishedName GroupCategory GroupScope Name
ObjectClass ObjectGUID SamAccountName SID
----------------- ------------- ---------- ----
----------- ---------- -------------- ---
CN=Test Group 1 Nested,OU=Tes... Security Global Test Group 1
Nested group 326195ba-2d8b-40f0-8a39-1c08... Test Group 1 Nested
S-1-5-21-3554682577-58629175...
The user is a direct member of the group "Test Group 1 Nested" only.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-ActiveDirectoryGroupMembership -Identity "CN=Christos Polydorou,CN=Users,DC=lab,DC=local" -Recurse
DistinguishedName GroupCategory GroupScope Name
ObjectClass ObjectGUID SamAccountName SID
----------------- ------------- ---------- ----
----------- ---------- -------------- ---
CN=Test Group 1 Parent,OU=Tes... Security Global Test Group 1
Parent group d19916ff-106a-49c4-9aa6-78fa... Test Group 1 Parent
S-1-5-21-3554682577-58629175...
CN=Test Group 1,OU=Test_OU,DC... Security Global Test Group 1
group 9c11c15f-d4e5-4afe-9f1a-06db... Test Group 1
S-1-5-21-3554682577-58629175...
CN=Test Group 1 Nested,OU=Tes... Security Global Test Group 1
Nested group 326195ba-2d8b-40f0-8a39-1c08... Test Group 1 Nested
S-1-5-21-3554682577-58629175...
The user is a direct member of the group "Test Group 1 Nested" only. The "Test Group 1 Nested" is a member of
"Test Group 1" which in turn is a member of "Test Group 1 Parent". Thus the user is concidered a member of all
groups
RELATED LINKS