Python – unlocking Locked user accounts on Active Directory using Python ldap module

active-directorypython

I recently implemented password reset on AD using python ldap module.

This involved passing modified attributes in this manner:

add_pass = [(ldap.MOD_REPLACE, "unicodePwd", )]

This worked since the passwords on AD are stored in attribute "unicodePwd".

Now I want to unlock a locked user account but I cannot find the attribute that must be changed to achieve the same.

Could you guys please tell me which attribute I have to change?

Best Answer

To unlock a user, you need to set the lockoutTime attribute to 0.