I want to write a VS 2010 C# app that can set my admin password. My user account is Ralph and I am an Admin but I don't have a password set so I can boot up and get right to the desktop. However, that being said, I'd like to be able set a password for my account using C#.
Thanks for any help...
How do I change my win7 admin password using C#?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Javeed M ShaikhRank #839 · 2.7K reputationPosted Aug 23, 2012, 12:04 AM EDT
using System;
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();
}