Active Directory: Copy a Group Members to a new Group


How would you copy the members (including users and groups) of GROUP-A to another group (GROUP-B)? I figured that out today.

Open Active Directory Module for Windows PowerShell in Administrative Tools and type the following command.

Get-ADGroupMember -Identity GROUP-A | Add-ADPrincipalGroupMembership -MemberOf GROUP-B

Get-ADGroupMember gets all the members of GROUP-A and pipes into Add-ADPrincipalGroupMembership cmdlet that added the incoming members to GROUP-B. 

Advertisements

9 thoughts on “Active Directory: Copy a Group Members to a new Group

  1. Thanks for posting this. Saved me a ton of time creating new groups with some minor adjustments. However, ran this through PowerShell 3 (as administrator) and it work just fine – did not have to use the AD Module for Windows Powershell.

  2. This works great, but only if the users in the results of the ‘Get-ADGroupMember’ are not members of a child domain. Is there a way to allow this to work for the entire directory?

  3. Is there a Power Shell way to add a list of user ID’s to a GROUP on the Windows Active Directory “UNIX Attributes” tab?

    I already entered the users on the GROUP MEMBERS tab, but now, I’m learning that I also have to list them again on the “UNIX Attributes” tab for our application to work. Any suggestions?

  4. Thanks for this, do you have a script that will add AD users within a parent group as well as the users of sub groups within that Parent group recursively to another AD group?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s