Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing Active Directory user password

How can I change an Active Directory user password using Directory Services without knowing old password?

like image 272
Abhimanyu Avatar asked Mar 31 '26 00:03

Abhimanyu


1 Answers

You are probably searching the SetPassword method, which you should invoke on a DirectoryEntry object.

Check the "Reset a User's Password" example here: Howto: (Almost) Everything In Active Directory via C#.

EDIT:
If you are having problems with the directory entry being null, you are probably passing a wrong path. The path should be something like this:

DirectoryEntry entry = new DirectoryEntry("LDAP://CN=johndoe,CN=Users,DC=acme,DC=com");
like image 96
Paolo Tedesco Avatar answered Apr 02 '26 12:04

Paolo Tedesco