Solved

Cannot remove Active Directory user

Posted on 2007-11-15
2
816 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
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

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.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

770 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