/// /// 更改Windows帐户密码 /// /// /// /// public static void ChangeWinUserPasswd(string username, string oldPwd, string newPwd) { try { DirectoryEntry localMachine = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer"); DirectoryEntry user = localMachine.Children.Find(username, "user"); object[] password = new object[] { oldPwd, newPwd }; object ret = user.Invoke("ChangePassword", password); user.CommitChanges(); localMachine.Close(); user.Close(); } catch (Exception) { } } //csharp/5475