If you’ve ever needed to group membership between to AD groups you could do this one by one which while does work, what happens if you have a list with 10, 20, 30,….or even 5000+ users? To copy the membership from one group into another via PowerShell under Server 2008 is a simple two lines (plus import command).
Import-Module ActiveDirectory $mymembers = Get-ADGroupMember -identity My_Source_Group_Name | Select-Object SamAccountName foreach($i in $mymembers){Add-ADGroupMember -Identity My_Destination_Group_Name -Members $i.SamAccountName}
Worked great for me! Any chance you can show how to add users from different child domains to the top level domain group. Your script fails if the username is not found in the same domain as the group created.
If using child domains you can used the DistinguishedName attribute instead of SamAccountName. Depending upon your topology, you may need to wrap the Add-ADGroupMember method with some string matching against the end of the DistinguishedName.