更新时间:2023-02-23 23:13:03
好的,我搞定了:
dirEntry = new DirectoryEntry(ldapPath, domainAdminUser, domainAdminPassword);
dirEntry.Invoke("SetPassword", new object[] { newPassword });
dirEntry.Properties["LockOutTime"].Value = 0; //unlock account
ldapPath 应该包含我们尝试更改的用户的完整 DN,因此它应该类似于:
ldapPath should include the full DN of the user we're trying to change , so it should look something like:
string ldapPath = "LDAP://ad.domain.com:389/CN=username,OU=Users,DC=ad,DC=domain,DC=com"