Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Cannot remove Active Directory user

Posted on 2007-11-15
2
Medium Priority
?
824 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 150 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

963 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