Can we change system password using .Net?
Can we change system password using .Net?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Raja TPosted Nov 22, 2015, 11:56 PM
using System.DirectoryServices;
string userPath = "WinNT://yourMachineName/adminuser";
using (DirectoryEntry userEntry = new DirectoryEntry(userPath))
{
object[] password = new object[] {"newPwd", "oldPwd"};
object ret = userEntry.Invoke("ChangePassword", password );
userEntry.CommitChanges();
}