DirectoryEntry directoryEntry = new DirectoryEntry(string.Format("WinNT://{0}/{1},user", computerName, "Administrator"), "Administrator", "AdminPW", AuthenticationTypes.Secure); foreach (DirectoryEntry childEntry in directoryEntry.Parent.Children) { if (childEntry.SchemaClassName == "User" && childEntry.Name == "TestUser") { childEntry.Invoke("SetPassword", new object[] { newPassword }); childEntry.CommitChanges(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)