"Srikanth" <ta*****@inooga.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi All,
Can any one tell me how to change windows user account password
by programmatically using C#? I don't have administrator privileges and I
want to change my account password by programmatically.
I will be thankful if you can provide a sample program.
Thanks in Advance,
Srikanth
Use the System.DirectoryServices to change the password of a local user
account.
Something like this will do.
using System;
using System.DirectoryServices;
// correct the userPath!!!
string userPath = "WinNT://yourMachineName/someuser";
using (DirectoryEntry userEntry = new DirectoryEntry(userPath))
{
object[] password = new object[] {"newPwd", "oldPwd"};
object ret = userEntry.Invoke("ChangePassword", password );
userEntry.CommitChanges();
}
Willy.