Notice: Due to size constraints and loading performance considerations, scripts referenced in blog posts are not attached directly. To request access, please complete the following form: Script Request Form Note: A Google account is required to access the form.
Disclaimer: I do not accept responsibility for any issues arising from scripts being run without adequate understanding. It is the user's responsibility to review and assess any code before execution. More information

Single Command : Copy Users from one group to another


If you have a requirement to copy all the users from one group to another group then sometimes the one liner commands are amazing, this is one of those, this is the command.

Note : You need to use the samAccountName for the group and not the UPN in this example, this is also known as the Pre-Windows 2000 name:

Get-ADGroupMember -Identity "<SourceGroupName>" | ForEach-Object {Add-ADGroupMember -Identity "<DestinationGroupName>" -Members $_.SamAccountName}

This will then take the source group members and copy them to destination group, this was handy for a one time command where the situation required it.

Previous Post Next Post

نموذج الاتصال