$res = $ldap->modify ($distinguishedName, # delete and readd the userAccountControl # this will disable the account delete => {userAccountControl=> []}, add => {userAccountControl => "514"} ); # if there is an error stop and let us know if ( $res->code()) { die ("error: ", $res->code(),"\n", "error name: ",$res->error_name(),"\n", "error text: ",$res->error_text(),"\n"); }