Solved

Cannot remove Active Directory user

Posted on 2007-11-15
2
819 Views
Last Modified: 2008-02-01
I am trying to remove a user from Active Directory. adConn is my DirectoryEntry with admin rights. I keep getting an error that says that there is no such object on the server. I know the object is there because earlier in the program i can retrieve it as a search result. What am I doing wrong?

            'Locate the actual account in AD that is to be deleted
            Dim tempUser As DirectoryServices.DirectoryEntry = adConn.Children.Find("CN=John Smith", "Users")

            'Delete the account
            adConn.Children.Remove(tempUser)
            'Confirm
            adConn.CommitChanges()
0
Comment
Question by:swuit
[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
2 Comments
 
LVL 16

Accepted Solution

by:
anoyes earned 50 total points
ID: 20295659
Have you tried continuing on with the tempUser LDAP path with your full domain?  Is "Users" a group, or an OU?
CN=John Smith,OU=Users,DC=domain,DC=com

I found a similar post on the ASP.net forums that might be worth taking a look at if you haven't seen it already.
http://forums.asp.net/t/1179504.aspx
0
 

Author Comment

by:swuit
ID: 20300681
I gave it the entire path. I used a DirectorySearcher and obtained the path from the result. I put the path in for adConn.Children.Find() to look for and it still tells me that there is nothing on the server.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

734 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