Solved

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

Posted on 2010-11-08
6
725 Views
Last Modified: 2012-05-10
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

0
Comment
Question by:mwmiller78
  • 3
  • 2
6 Comments
 
LVL 28

Expert Comment

by:Michael Pfister
ID: 34091817
The member attribute doesn't take an ADsPath. Remove the LDAP:// and it should be fine.
HTH
0
 
LVL 28

Expert Comment

by:Michael Pfister
ID: 34091824
BTW, 0x80072035 means  "The  server is unwilling to process the request"
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 34091888
0
 

Author Comment

by:mwmiller78
ID: 34093836
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

0
 

Author Comment

by:mwmiller78
ID: 34093851
Our format for CN is LastName, FirstName and for sAMAccount its just the network logon. What is the property I should be using here?
0
 
LVL 28

Accepted Solution

by:
Michael Pfister earned 500 total points
ID: 34093944
Use the distinguished name of the user you want to add.

group.Properties("member").Add("CN=myuser1,OU=Pending Users,OU=Users,OU=xyz,OU=abc,OU=AMR,OU=myou,DC=mycorp,DC=org")

HTH
0

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now