在使用以下代码使用户在 python 中使用 ldap3 库时,出现如下所述的错误
与 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)
启用用户的代码:
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)
错误 :
{'result': 53, 'description': 'unwillingToPerform', 'dn': '', 'message': '0000052D: SvcErr: DSID-031A12D2, problem 5003 (WILL_NOT_PERFORM), data 0\n\x00', 'referrals': None, 'type': 'modifyResponse'}
如果有任何建议或解决方案,请分享。如果需要更多详细信息。请输入comments.c