1

I have figured out how to add active directory groups to a user using the following command

Add-ADGroupMember -Identity "Group Name" -Members "UserName"

Is there a way to add multiple groups to a user or multiple users to a group? I have tried comma separating the users and groups but it doesn't seem to work.

3
  • The Members parameter can take an array of users, as long as you give it the DistinghuishedNames, SamAccountNames, GUIDs or SIDs Commented Dec 20, 2019 at 11:13
  • Add-ADGroupMember -Identity "Group Name" -Members "UserName1", "UserName2", "UserName3" does work. Are you getting any errors? Commented Dec 20, 2019 at 11:13
  • Yeah it works on the users, is there anyway to do the same for multiple groups? It appears that comma separating doesn't work Commented Dec 20, 2019 at 11:25

1 Answer 1

2
get-aduser username | Add-ADPrincipalGroupMembership -MemberOf "group1","group2"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.