Copying Active Directory Group Memberships with PowerShell

In Active Directory, a user’s access to resources is usually determined by their group memberships. 

Connect to AD can manage memberships automatically through Group Mappings, but sometimes administrators need a quick, manual way to copy group memberships from one account to another.

This can be done with a simple PowerShell command:

Get-ADUser -Identity "SourceUserSamAccountName" -Properties memberof | Select-Object -ExpandProperty memberof | Add-ADGroupMember -Members "TargetUserSamAccountName"

This command retrieves all the groups from the source user and adds the target user to each of them.


 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.