Hi, I need some help disabling Active Directory users with NET::LDAP. I am able to connect to the User and modify/add other values.
looking here, http://support.microsoft.com/kb/305144, it says that the userAccountControl flag for disabled is 2, but if I look in ADSI edit it seems that disabled accounts have the userAccountControl set as 514. I cant seem to set either of those values in my script.
Here is a bit of my code
$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"); }
The error I receive from the above code is;
error:53
error name: LDAP_UNWILLING_TO_PERFORM
error text: The server is unwilling to perform the requested operation
I guess the way I am trying to modify the userAccountControl attribute is not supported but I am not sure how to go about changing it.
I can change the value in ADSI edit and it enables/disables accounts ok but maybe it is hiding the actual process.
Any help is appreciated.
In reply to NET::LDAP disable AD user by OldManYoss
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |