Link to home
Start Free TrialLog in
Avatar of Member_2_1242703
Member_2_1242703

asked on

Adding a user to an ActiveDirectory security group via ASP.NET(VB) page

I'm trying to add a user to a security group using the code below. I am continuing to get the error:

"The server is unwilling to process the request. (Exception from HRESULT: 0x80072035)"

on the CommitChanges line. Any ideas??


Dim group As New DirectoryEntry("LDAP://xx.xxx.xxx.xxx/CN=ussrm-users,OU=Security Groups,OU=Groups,OU=xyz,OU=abc,OU=AMR,OU=myou,DC=mycorp,DC=org")
group.Properties("member").Add("LDAP://xx.xxx.xxx.xxx/sAMAccountName=myuser1,OU=Pending Users,OU=Users,OU=xyz,OU=abc,OU=AMR,OU=myou,DC=mycorp,DC=org")
group.CommitChanges()

Open in new window

Avatar of Michael Pfister
Michael Pfister
Flag of Germany image

The member attribute doesn't take an ADsPath. Remove the LDAP:// and it should be fine.
HTH
BTW, 0x80072035 means  "The  server is unwilling to process the request"
Avatar of Member_2_1242703
Member_2_1242703

ASKER

I have tried each of the following to no avail:


group.Properties("member").Add("xx.xxx.xxx.xxx/sAMAccountName=userID")
group.Properties("member").Add("sAMAccountName=userID")
group.Properties("member").Add("CN=LastName\, FirstName")
group.Properties("member").Add("10.208.251.125/CN=LastName\, FirstName")
group.Properties("member").Add("LastName, FirstName")

Open in new window

Our format for CN is LastName, FirstName and for sAMAccount its just the network logon. What is the property I should be using here?
ASKER CERTIFIED SOLUTION
Avatar of Michael Pfister
Michael Pfister
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial