System.DirectoryServices.AccountManagement: Change existing password

M

MarkusJ_NZ

Hi, I am using the new System.DirectoryServices.AccountManagement
class of .NET 3.5 to do some user maintenance work via an ASP.NET
webform.

My question is how to I reset a users password if they have forgotten
their password?

The only method I have found is the ChangePassword() method which
needs the old password.

I was hoping that I could authenticate as a domain admin, create a new
instance of the user who's password I want to reset.

e.g.

PrincipalContext domainContext = new PrincipalContext
(ContextType.Domain);
UserPrincipal user = UserPrincipal.FindByIdentity(domainContext,
"joeBloggs");
user.ChangePassword("newPassword");
user.Save();

Unfortunately, the the ChangePassword() methods accepts two parameters
the old and new passwords..

So, how can I programatically reset a users password if I do not know
the old password?

Thanks
Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top