If I try the following:
using (DirectoryEntry user = new DirectoryEntry("LDAP://CN=myuser,OU=x,DC=y,DC=z")) {
user.Invoke("ChangePassword", new object[] { "oldpwd", "newpwd" });
}
I get an exception saying that the password does not meet password policy requirements (HRESULT: 0x800708C5).
The strange thing is that the password does meet the requirements, and if I try to invoke SetPassword
instead, with the same password, the call succeeds:
using (DirectoryEntry user = new DirectoryEntry("LDAP://CN=myuser,OU=x,DC=y,DC=z")) {
user.Invoke("SetPassword", new object[] { "newpwd" }); // ok
}
What is the difference between the two methods? Is it possible that the password complexity message is, in this case, wrong? If so, any idea about what could be the problem?