Powershell : add users from one group to another.

Simple script to add multipe users from one group to another easily.

 

Will show on screen error if they already are members of the destination group but carry on going on error.

 

 

======================================================================================

$Source_Group = “CN=MAC,OU=Test Groups,OU=Groups,OU=GB,,DC=whatever,DC=com”

$Destination_Group = “CN=newMAC,OU=Test Groups,OU=Groups,OU=GB,,DC=whatever,DC=com”

 

$Target = Get-ADGroupMember -Identity $Source_Group

foreach ($Person in $Target) {

Add-ADGroupMember -Identity $Destination_Group -Members $Person.distinguishedname

}

 

Leave a Reply

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