c# LDAP Delete Active Directory user

UserDn : ldap path of the user account which is gonna delete.
admin : Priviledged user to delete mean admin account
adminpass : you know what is this 🙂



public static void DeleteUser(string userDn, string admin, string adminpass)
        DirectoryEntry user = new DirectoryEntry(userDn, admin, adminpass);
    catch (System.DirectoryServices.DirectoryServicesCOMException ex)

About bpostaci
Escalation Engineer in Microsoft.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: