How to change active directory User Account Password using code?


I wouldn't do this personally.

But you can as long as you have sufficient permissions something like:

DirectoryEntry myADUser = new
myADUser.Invoke("<opass>", "<npass>");
  • where we have to pass username ? – Rajesh Joshi Nov 2 '12 at 9:14
  • what permission should the loggedin user have to perform this operation? Is it enough to use RWEP to perform this? – variable Jul 12 '14 at 5:40
  • The Change Password permission in AD, on system and elevate the task, or not at all if its their own password by default I believe. You are best to go check with the Active Directory team what you are allowed to do. – Hugh Wood Aug 6 '14 at 10:59

Here's an opensource webpart that enables users to change their password:

ITaCS Change Password web part

I use this webpart myself and am satisfied about it. The source code is available for viewing. It might inspire you for your own programming need.

  • 2
    I've been using this in production. It works very well. I recommend it and also recommend reviewing its code. – bgmCoder Dec 19 '12 at 15:10
  • Project 'changepassword' was not found – Mark L Aug 7 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.