Solved

Cannot remove Active Directory user

Posted on 2007-11-15
2
813 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
2 Comments
 
LVL 16

Accepted Solution

by:
anoyes earned 50 total points
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

772 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

10 Experts available now in Live!

Get 1:1 Help Now