Forum Discussion
sofo-83
Mar 30, 2022Copper Contributor
add just one user to many groups
Hi please help me to make a script in PowerShell to add just one user to many groups
Apr 03, 2022
Did this work out for you?
- sofo-83Apr 05, 2022Copper Contributor
Thanks a lot
is the group name must be as a string (name) or should I bring the object ID? Harm_Veenstra- Apr 05, 2022
The name of the group as you see it in Active Directory, Display Name I guess. Let me know if it worked out for you, you can mark my answer as solution to mark it as solved if it does
- sofo-83Apr 05, 2022Copper ContributorForEach ($Group in $Groups) {Add-AzureADGroupMember -ObjectId "username" -MemberOf $Group}
I have changed the parameter Add-ADPrincipalGroupMembership to Add-AzureADGroupMember
but still get error for the parametr -MemberOf .
Add-AzureADGroupMember : A parameter cannot be found that matches parameter name 'MemberOf'.