PowerShell Logo Small

Get-ADPrincipalGroupMembership



This is the built-in help made by Microsoft for the command 'Get-ADPrincipalGroupMembership', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Gets the Active Directory groups that have a specified user, computer, group, or service account.

SYNTAX


Get-ADPrincipalGroupMembership [-Identity] <ADPrincipal> [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-Partition <String>] [-ResourceContextPartition
<String>] [-ResourceContextServer <String>] [-Server <String>] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Get-ADPrincipalGroupMembership cmdlet gets the Active Directory groups that have a specified user, computer, group, or service account as a member. This cmdlet requires
a global catalog to perform the group search. If the forest that contains the user, computer or group does not have a global catalog, the cmdlet returns a non-terminating
error. If you want to search for local groups in another domain, use the ResourceContextServer parameter to specify the alternate server in the other domain.


The Identity parameter specifies the user, computer, or group object that you want to determine group membership for. You can identify a user, computer, or group object by
its distinguished name (DN), GUID, security identifier (SID) or SAM account name. You can also specify a user, group, or computer object variable, such as
$<localGroupObject>, or pass an object through the pipeline to the Identity parameter. For example, you can use the Get-ADGroup cmdlet to retrieve a group object and then
pass the object through the pipeline to the Get-ADPrincipalGroupMembership cmdlet. Similarly, you can use Get-ADUser or Get-ADComputer to get user and computer objects to
pass through the pipeline.


For AD LDS environments, the Partition parameter must be specified except in the following two conditions:

-- The cmdlet is run from an Active Directory provider drive.
-- A default naming context or partition is defined for the AD LDS environment. To specify a default naming context for an AD LDS environment, set the
msDS-defaultNamingContext property of the Active Directory directory service agent (DSA) object (nTDSDSA) for the AD LDS instance.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=291037
Add-ADGroupMember
Add-ADPrincipalGroupMembership
Get-ADComputer
Get-ADGroup
Get-ADGroupMember
Get-ADUser
Remove-ADGroupMember
Remove-ADPrincipalGroupMembership

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>Get-ADPrincipalGroupMembership -server localhost:60000 -Identity "CN=GlenJohns,DC=AppNC" -partition "DC=AppNC"



This command retrieves all the groups the user CN=GlenJohns,DC=AppNC is a member of on an AD LDS instance.




-------------------------- EXAMPLE 2 --------------------------

PS C:\>Get-ADPrincipalGroupMembership -Identity Administrator


distinguishedName : CN=Domain Users,CN=Users,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : Global
name : Domain Users
objectClass : group
objectGUID : 86c0f0d5-8b4d-4f35-a867-85a006b92902
SamAccountName : Domain Users
SID : S-1-5-21-41432690-3719764436-1984117282-513

distinguishedName : CN=Administrators,CN=Builtin,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : DomainLocal
name : Administrators
objectClass : group
objectGUID : 02ce3874-dd86-41ba-bddc-013f34019978
SamAccountName : Administrators
SID : S-1-5-32-544

distinguishedName : CN=Schema Admins,CN=Users,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : Universal
name : Schema Admins
objectClass : group
objectGUID : 8d62890f-385e-4cfa-9b2a-c72576097583
SamAccountName : Schema Admins
SID : S-1-5-21-41432690-3719764436-1984117282-518

distinguishedName : CN=Enterprise Admins,CN=Users,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : Universal
name : Enterprise Admins
objectClass : group
objectGUID : 0215b0a5-aea1-40da-b598-720efe930ddf
SamAccountName : Enterprise Admins
SID : S-1-5-21-41432690-3719764436-1984117282-519

distinguishedName : CN=Domain Admins,CN=Users,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : Global
name : Domain Admins
objectClass : group
objectGUID : 5ccc6037-c2c9-42be-8e92-c8f98afd0011
SamAccountName : Domain Admins
SID : S-1-5-21-41432690-3719764436-1984117282-512

distinguishedName : CN=Group Policy Creator Owners,CN=Users,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : Global
name : Group Policy Creator Owners
objectClass : group
objectGUID : a58f7bf2-fd20-4bbd-96f0-ee10fa1613c7
SamAccountName : Group Policy Creator Owners
SID : S-1-5-21-41432690-3719764436-1984117282-520



This command retrieves all the groups the administrator is a member of.




-------------------------- EXAMPLE 3 --------------------------

PS C:\> Get-ADPrincipalGroupMembership -Identity Administrator -ResourceContextServer ChildDomain.Fabrikam.Com -ResourceContextPartition "DC=Fabrikam,DC=com"


distinguishedName : CN=Domain Users,CN=Users,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : Global
name : Domain Users
objectClass : group
objectGUID : 86c0f0d5-8b4d-4f35-a867-85a006b92902
SamAccountName : Domain Users
SID : S-1-5-21-41432690-3719764436-1984117282-513

distinguishedName : CN=Group Policy Creator Owners,CN=Users,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : Global
name : Group Policy Creator Owners
objectClass : group
objectGUID : a58f7bf2-fd20-4bbd-96f0-ee10fa1613c7
SamAccountName : Group Policy Creator Owners
SID : S-1-5-21-41432690-3719764436-1984117282-520

distinguishedName : CN=Enterprise Admins,CN=Users,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : Universal
name : Enterprise Admins
objectClass : group
objectGUID : 0215b0a5-aea1-40da-b598-720efe930ddf
SamAccountName : Enterprise Admins
SID : S-1-5-21-41432690-3719764436-1984117282-519

distinguishedName : CN=Schema Admins,CN=Users,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : Universal
name : Schema Admins
objectClass : group
objectGUID : 8d62890f-385e-4cfa-9b2a-c72576097583
SamAccountName : Schema Admins
SID : S-1-5-21-41432690-3719764436-1984117282-518

distinguishedName : CN=Domain Admins,CN=Users,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : Global
name : Domain Admins
objectClass : group
objectGUID : 5ccc6037-c2c9-42be-8e92-c8f98afd0011
SamAccountName : Domain Admins
SID : S-1-5-21-41432690-3719764436-1984117282-512

distinguishedName : CN=Administrators,CN=Builtin,DC=Fabrikam,DC=com
GroupCategory : Security
GroupScope : DomainLocal
name : Administrators
objectClass : group
objectGUID : 02ce3874-dd86-41ba-bddc-013f34019978
SamAccountName : Administrators
SID : S-1-5-32-544



This command retrieves all the groups the adminsitrator account in the local domain is a member of in the resource domain ChildDomain.Fabrikam.Com.