removing user from active directory

inter

Active member
Joined
Jul 22, 2005
Messages
36
Dear,

Im trying to remove a user from active directory... unfortunately this doesnt work....Im using the code below but this failes... I use the administrator as DirectoryEntry but for some reason it doesnt find the other user in its child objects....
C#:
using System.DirectoryServicesprivate 
DeleteUserFromActiveDirectory(DataRow in_Gebruiker){   
DirectoryEntry AD = new DirectoryEntry(strPathActiveDirectory , 
                 strUsername, strPassword)	   
DirectoryEntry NewUser =                   
AD.Children.Find("CN=TheUserName", "User");   
AD.Children.Remove(NewUser);   
AD.CommitChanges();   
AD.Close();
}
When I use a filter, I DO find the the child object. but then I still cant remove the user... (I think because the remove uses the same search method as the build in "Find")

help is more then welcome,

thank you,
 
Last edited by a moderator:
Back
Top