PowerShell Logo Small

Add-ADGroupMember



This is the built-in help made by Microsoft for the command 'Add-ADGroupMember', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 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

Adds one or more members to an Active Directory group.

SYNTAX


Add-ADGroupMember [-Identity] <ADGroup> [-Members] <ADPrincipal[]> [-AuthType <ADAuthType>] [-Credential <PSCredential>] [-Partition <String>]
[-PassThru [<SwitchParameter>]] [-Server <String>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


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 cmdlet.


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.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkID=219287
Add-ADPrincipalGroupMembership
Get-ADGroup
Get-ADGroupMember
Get-ADPrincipalGroupMembership
Remove-ADGroupMember
Remove-ADPrincipalGroupMembership

REMARKS

<

Examples


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

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



Description

-----------

Adds the user accounts with SamAccountNames SQL01,SQL02 to the group SvcAccPSOGroup.




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

C:\PS>Add-ADGroupMember

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



Description

-----------

Demonstrates default behavior for this cmdlet (no parameters specified). Adds user accounts with SamAccountNames JohnSmith and JeffPrice to
the group RodcAdmins.




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

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



Description

-----------

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 --------------------------

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



Description

-----------

Adds the user "CN=Glen John,OU=UserAccounts" from the North America domain to the group "CN=AccountLeads,OU=UserAccounts" in the Europe domain.