skip to Main Content

Copy members from one AD group to another

AD groups are great for managing users, computers, groups, and other AD objects. This time you created a new AD group in Active Directory, and you want to copy members from one AD group to the new group. How to copy members from security group to distribution groups or the other way around? This article will teach you how to copy members from one AD group to another with PowerShell.

Information

If you have a couple of members, you can search and select them in Active Directory Users and Computers (ADUC). But what if you have many members, let’s say a thousand. Or, what if you want to be precise with copying members.

By reading another group from a list and adding them to another group is not bulletproof. You can miss a member, and that’s not what you want. That’s when you want to use PowerShell.

In our example, we like to copy the users from the AD group SG_Azure_A to another AD group SG_Azure_B.

  • Source: SG_Azure_A
  • Target: SG_Azure_B

Copy members from one AD group to another

AD members that we can copy

To copy members from one AD group to another will work for all group scopes and group types:

  • Group scope: Domain local / Global / Universal
  • Group type: Security / Distribution

Copy members will work criss-cross between the AD groups. For example, you have members in a Global Security, and you want to copy members to another Universal Distribution group, it works excellent.

In our example, we will copy members from a Universal Security group to another Universal Security group.

Copy members from one AD group to another group scope group type

Good to know is that it will copy all Object Types from the member’s group.

Copy members from one AD group to another copy objects

Copy members from one AD group to another with PowerShell

Run PowerShell as administrator. List the members in the source AD group. Make use of Get-AdGroupMember cmdlet.

Get the target group and use the ForEach-Object cmdlet to add the members to the source AD group.

Do you want to copy members from one distribution group to another AD group? The only thing you need to change is the source and target AD groups.

Verify target AD group members

With the previous cmdlet, we did copy members from one AD group to another. It’s good to list the target AD group and verify that the copy did go successfully.

Verify the target AD group in ADUC.

Copy members from one AD group to another after

We did successfully copy AD members from one AD group to another AD group. In our example, we did copy the members from a Universal Security group to another Universal Security group that is empty.

Read more: Convert Global to Universal Security Group with PowerShell »

Conclusion

You learned how to copy members from one AD group to another with PowerShell. If you have a couple of members, you can use Active Directory Users and Computers and add members to the AD group. If you have many members and want to speed up your work, your best way is PowerShell.

Did you enjoy this article? You may also like List all users in a Security Group through PowerShell. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top