Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2010-11-08
6
Medium Priority
?
733 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:Mike Miller
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 29

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 29

Expert Comment

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

Expert Comment

by:Meir Rivkin
ID: 34091888
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Mike Miller
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:Mike Miller
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 29

Accepted Solution

by:
Michael Pfister earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

618 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