Skip to content
Categories:

Copy group membership

Post date:
Author:

Short script to copy group membership from one account to another.

1
2
3
4
5
6
$CopyFromUser = Get-ADUser user1 -prop MemberOf
$CopyToUser = Get-ADUser user2 -prop MemberOf

$CopyFromUser.MemberOf |
    Where-Object {$CopyToUser.MemberOf -notcontains $_} |  
    Add-ADGroupMember -Members $CopyToUser