Copy User Membership KB ID 0001828
Problem
If you have a lot of user groups and simply want to copy/clone one users group membership to another user, then with PowerShell that’s quite simple to do.
Solution: Copy User Membership
Here I have two users ALane who is a member of a few groups and APatel who is simply a member of domain admins.
Although we can see above what groups ALane is a member off let’s prove that will PowerShell.
[box]
Get-ADUser -Identity ALane -Properties memberof | Select-Object -ExpandProperty memberof
[/box]
Copy User Membership
Then let’s copy the groups from ALane to APatel.
[box]
Get-ADUser -Identity ALane -Properties memberof | Select-Object -ExpandProperty memberof | Add-ADGroupMember -Members APatel
[/box]
And finally, lats make sure APatel is a member of those groups.
[box]
Get-ADUser -Identity APatel -Properties memberof | Select-Object -ExpandProperty memberof
[/box]
Or simply look in Active Directory users and computers (you might need to refresh if you already had APatel’s properties open!)
Related Articles, References, Credits, or External Links
NA