C# DirectoryEntry.Invoke 调用目标引发了异常。一个或多个输入参数无效

C# DirectoryEntry.Invoke Exception has been thrown by the target of an invocation. One or more input parameters are invalid

 usr.Invoke("ChangePassword", new object[] { strCurrentPassword, strPassword});

此 api 在 Active Directory 的某些环境中有效,但在某些环境中失败并出现以下异常

invocation.One 个或多个无效输入参数的目标已抛出异常。

即使以下情况也是正确的 "Exception has been thrown by the target of an invocation.One or more input parameters are invalid" 主要是在您尝试应用的新密码违反 Active Directory 密码策略时才会出现。

最近微软推出了一个新的更新https://technet.microsoft.com/library/security/ms16-101 不允许使用 NONSSL 配置更改管理员以外的密码。它需要最少的 Kerberos 或 SSL 来执行 changePassword。他们删除了对 NTLM 的支持,这是早期使用的默认机制。