Getting an error:
Server is unwilling to perform
while changing unicodePwd in AD through PHP. However, I'm able to search, add, remove and modify any attributes of the users.
Using Administrator account to bind and admin has full rights to change passwords of any users.
Here's the code I'm using:
<?php
$dn = "CN=Vishal Makwana,OU=Address Book,DC=example,DC=com";
$ad = ldap_connect("ldap://example.com")
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
$bd = ldap_bind($ad,"[email protected]","admin1");
if($bd) {
echo "AD bind successfully";
}
else {
echo "Couldn't bind AD";;
}
$user["unicodePwd"] = "asdf1234";
$result = ldap_mod_replace($ad, $dn, $user);
if ($result) echo "User modified!"; else
echo "There was a problem!";
ldap_unbind($ad);
?>