OldManYoss has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: NET::LDAP disable AD user
by dasgar (Priest) on Sep 28, 2010 at 11:26 UTC | |
by OldManYoss (Initiate) on Sep 28, 2010 at 12:27 UTC | |
by dasgar (Priest) on Sep 28, 2010 at 12:53 UTC | |
by locked_user sundialsvc4 (Abbot) on Sep 28, 2010 at 13:32 UTC | |
by OldManYoss (Initiate) on Sep 30, 2010 at 07:52 UTC | |
by Anonymous Monk on Mar 22, 2013 at 09:16 UTC |