Assign multiple groups to Ldap User programmatically

765 Views Asked by At

Is it possible to assign multiple groups to a user that's programmatically added to LDAP. If yes, what should be the format followed.

1

There are 1 best solutions below

0
RahulKumarShaw On BEST ANSWER

We don’t assign group/groups to a user. For Correcting you we generally do assign a user as a member of a group.

Hoping you are already setup Active Directory in Your Environment. If not, you can refer this link

For adding a user to Multiple groups, you can use this PowerShell Script.

$Groups = @("group1","group2","groupN")

foreach($group in $groups){
    Add-ADGroupMember -Identity $group -Members "UserName"
}

Reference : https://community.spiceworks.com/topic/2128061-powershell-adding-a-single-user-to-multiple-groups