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
Solved

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

Posted on 2010-11-08
6
729 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Powershell Active Directory Attribute LVR Metadata 3 17
AD and Exchnage 2010 Photos 3 41
Office 365 Public IP configuration on DNS ? 7 51
Domian name change 12 23
This article runs through the process of deploying a single EXE application selectively to a group of user.
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
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…
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 …

807 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