Delphi: How can I change the password for a MS Active Directory account?

How to change a MS Active Directory account password using LDAP component in Delphi.

Date Entered: 02/24/2015    Last Updated: 02/24/2015

In order to change a MS AD account password using LDAP you will need to convert the unicode password to a RawByteString.

For Example:
ipsLDAPS1->AttrCount = 1; ipsLDAPS1->AttrType[0] = "unicodePwd"; UnicodeString uStr = L"\"Mynewpassword1\""; ipsLDAPS1->AttrValueB[0] = RawByteString((char*)uStr.data(), uStr.Length()*2); ipsLDAPS1->AttrModOp[0] = (TipsLDAPSAttrModOps)amoReplace; ipsLDAPS1->Modify();

Note that when converting a unicode password to a RawByteString the AttrValuB property should be used.


We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.