I am looking for a way to change the password of a local user account (local Administrator) on a Windows (XP in this case) machine. I have read the CodeProject article about
Try the DirectoryEntry
class instead of ManagementObject
class.
As Ely noted, you can use the System.DirectoryServices code to accomplish this per MSDN:
String myADSPath = "LDAP://onecity/CN=Users,
DC=onecity,DC=corp,DC=fabrikam,DC=com";
// Create an Instance of DirectoryEntry.
DirectoryEntry myDirectoryEntry = new DirectoryEntry(myADSPath);
myDirectoryEntry.Username = UserName;
myDirectoryEntry.Password = SecurelyStoredPassword;