Solved

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

Posted on 2010-11-08
6
731 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 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
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This article explains the steps required to use the default Photos screensaver to display branding/corporate images
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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…
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…

705 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