I've met a error when I try to update the password of the user from Active Directory
by invoke method
DirectoryEntry.Invoke("changepassword", object[]{oldPassword, newPassword})
The new password is complex enough and can update the password successfully when the length of the new password is less than 63(include 63)
, but when the length of the new password is larger than 63
, one error happened. The error message is:
Unable to update the password. The value provided for the new password does not meet the length, complexity, or history requirement of the domain.(Exception from HRESULT: 0x8007052D).
The code is:
public static void ChangePassword(DirectoryEntry user, string oldPassword, string newPassword)
{
oldPassword = (oldPassword == null) ? string.Empty : oldPassword;
newPassword = (newPassword == null) ? string.Empty : newPassword;
if (oldPassword != newPassword)
{
user.Invoke("ChangePassword", new object[] { oldPassword, newPassword });
}
}
I don't know why it happened now, does anyone know that? thank you!
User contributions licensed under CC BY-SA 3.0