Solved

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

Posted on 2010-11-08
6
727 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Resolve DNS query failed errors for Exchange
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 configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

919 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

21 Experts available now in Live!

Get 1:1 Help Now