如何在活动目录中使用 ldap3 将现有条目(用户)添加到现有组

How to add existing entry (user) to an existing group using ldap3 in active directory

我看过有关如何使用 LDAP3 向活动目录中的现有组添加新条目的文档和大量示例,但 none 将现有用户或条目添加到另一个现有组。 (要明确条目已经存在于其他组中,只需要添加到另一个组中)。

我已经尝试过 LDAP3 ADD 函数,该函数抛出错误,因为条目已经存在并且只允许文档中指定的新条目。

你能帮我解决这个问题吗?

能够使用以下函数使其工作

ldap3.extend.microsoft.addMembersToGroups.ad_add_members_to_groups(connection, members_dn, groups_dn, fix=True, raise_error=False)

文档 link:https://ldap3.readthedocs.io/ldap3.extend.microsoft.addMembersToGroups.html

这个 post 帮助了我:。 (不确定我的 post 是否会被视为重复,因为原始 post 没有明确提及问题所在。)