Just because I always have to search for this script, and Always need to test the script to verify integrity, here’s the script that WORKS.
You only have to replace the value of $sourcegroup and $targetgroup.
Cheers!
<# .SYNOPSIS Clone-Group .DESCRIPTION Clones group Members from Source to Target .NOTES Have both Source and Target group Distinguished Name at hand .LINK #> #Set Source and Target Group Distinguished Name $sourceGroup = [ADSI]"LDAP://CN=MYGROUPNAME,OU=MYCHILDOU,OU=MYPARENTOU,DC=CONTOSO,DC=LOCAL" $targetGroup = [ADSI]"LDAP://CN=MYGROUPNAME2,OU=MYCHILDOU2,OU=MYPARENTOU,DC=CONTOSO,DC=LOCAL" "Source Group: $($sourceGroup.samAccountName)" "Target Group: $($targetGroup.samAccountName)" "`nCloning Source Group to TargetGroup`n" #get Source members foreach ($member in $sourceGroup.Member) { Try { "Adding Member: $member" $targetGroup.add("LDAP://$($member)") } Catch { Write-Host "Error performing add action" -Fore DarkRed } }