While enabling user using ldap3 library in python with below code, getting error as mentioned below
connection to AD
server_ip = "192.xxx.0.145"
admin_username = "Domain\\Administrator"
admin_password = "Password"
ad_server = Server(server_ip, get_info=ALL)
conn = Connection(ad_server, user=admin_username,password=admin_password, auto_bind=True)
Code to enable user:
dn = "CN=Ak3s,OU=test_ou,DC=domain,DC=com"
attr_changes = [
{
"attr": "userAccountControl",
"value": '512'
}
]
changes = {}
for change in attr_changes:
changes[change['attr']] = [
(MODIFY_REPLACE, [change['value']])
]
user_update = conn.modify(dn=dn, changes=changes)
print(conn.result)
Error :
{'result': 53, 'description': 'unwillingToPerform', 'dn': '', 'message': '0000052D: SvcErr: DSID-031A12D2, problem 5003 (WILL_NOT_PERFORM), data 0\n\x00', 'referrals': None, 'type': 'modifyResponse'}
Kindly share if any suggestions or solutions for the same. if more details required. kindly put in comments.c