PowerShell Logo Small


This is the built-in help made by Microsoft for the command 'Add-ADGroupMember', 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.


Adds one or more members to an Active Directory group.


Add-ADGroupMember [-Identity] <ADGroup> [-Members] <ADPrincipal[]> [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-Partition <String>] [-PassThru] [-Server
<String>] [-Confirm] [-WhatIf] [<CommonParameters>]

Search powershellhelp.space


The Add-ADGroupMember cmdlet adds one or more users, groups, service accounts, or computers as new members of an Active Directory group.

The Identity parameter specifies the Active Directory group that receives the new members. You can identify a group by its distinguished name (DN), GUID, security identifier
(SID) or Security Accounts Manager (SAM) account name. You can also specify group object variable, such as $<localGroupObject>, or pass a group object through the pipeline
to the Identity parameter. For example, you can use the Get-ADGroup cmdlet to get a group object and then pass the object through the pipeline to the Add-ADGroupMember

The Members parameter specifies the new members to add to a group. You can identify a new member by its distinguished name (DN), GUID, security identifier (SID) or SAM
account name. You can also specify user, computer, and group object variables, such as $<localUserObject>. If you are specifying more than one new member, use a
comma-separated list. You cannot pass user, computer, or group objects through the pipeline to this cmdlet. To add user, computer, or group objects to a group by using the
pipeline, use the Add-ADPrincipalGroupMembership cmdlet.

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.



Online Version: http://go.microsoft.com/fwlink/p/?linkid=291006




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

PS C:\>Add-ADGroupMember -Identity SvcAccPSOGroup -Members SQL01,SQL02

This command adds the user accounts with SamAccountNames SQL01,SQL02 to the group SvcAccPSOGroup.

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

PS C:\>Add-ADGroupMember
cmdlet Add-ADGroupMember at command pipeline position 1
Supply values for the following parameters:
Identity: RodcAdmins
Members[0]: JohnSmith
Members[1]: JeffPrice

This command adds user accounts with SamAccountNames JohnSmith and JeffPrice to the group RodcAdmins.

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

PS C:\>Get-ADGroup -Server localhost:60000 -SearchBase "OU=AccountDeptOU,DC=AppNC" -Filter { name -like "AccountLeads" } | Add-ADGroupMember -Members

This command gets a group from the Organizational Unit OU=AccountDeptOU,DC=AppNC in the AD LDS instance localhost:60000 that has the name AccountLeads and then pipes it to
Add-ADGroupMember, which then adds the user account with DistinguishedName CN=SanjayPatel,OU=AccountDeptOU,DC=AppNC to it.

-------------------------- EXAMPLE 4 --------------------------

PS C:\>$user = Get-ADUser -Identity "CN=Glen John,OU=UserAccounts,DC=NORTHAMERICA,DC=FABRIKAM,DC=COM" -Server "northamerica.fabrikam.com"
PS C:\> $group = Get-ADGroup -Identity "CN=AccountLeads,OU=UserAccounts,DC=EUROPE,DC=FABRIKAM,DC=COM -Server "europe.fabrikam.com"
PS C:\> Add-ADGroupMember -Identity $group -Member $user -Server "europe.fabrikam.com"

This command adds the user CN=Glen John,OU=UserAccounts from the North America domain to the group CN=AccountLeads,OU=UserAccounts in the Europe domain.