SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to change active directory User Account Password using code?

share|improve this question
up vote 3 down vote accepted

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>");
share|improve this answer
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
Please can you answer my question above . Thanks. – variable Aug 5 '14 at 3:44
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.

share|improve this answer
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

I don't think there's anything wrong with changing active directory password through webpart anyway why reinvent the wheel ? here's link to one already created.


share|improve this answer
how ever de-voted it, provide reason for it ! – Mathematics Nov 2 '12 at 10:01
I didn't down vote, but I'd image it's because you suggested a 3rd party tool and you did not mention if you were connected with it in any way nor did you mention if it was paid or free. But that's just a guess. – Robert Kaucher Feb 17 '15 at 13:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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