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.

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.

 

Run PowerShell as administrator. List the members in the source AD group

#    PS C:\> Get-ADGroupMember -Identity “SG_Azure_A” | Select-Object Name | Sort-Object Name

 

Copy the users from group SG_Azure_A ( source ) to SG_Azure_B ( target group ) 

Get-ADGroupMember -Identity “SG_Azure_A” | ForEach-Object {Add-ADGroupMember -Identity “SG_Azure_B” -Members $_.distinguishedName}

 

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

 

Verify target AD group members

#    Get-ADGroupMember -Identity “SG_Azure_B” | Select-Object Name | Sort-Object Name