从特定标题和组创建新组

Create new group from specific title and group

我的 LDAP 真的很糟糕,所以我真的不知道从哪里开始。

是否可以与来自另一个具有特定标题的组的用户创建新的分发或安全组?用户太多,无法手动添加。

了解您希望如何与 AD 交互会很有帮助——编写程序(语言?)或使用 LDAP 客户端(哪个?)。我将提供有关使用远程服务器管理工​​具中的 ldifde.exe 的信息。要获取另一个组 中具有特定标题的 DN 的列表,请使用具有标题和成员资格要求的过滤器

ldifde -f output.txt -r "(&(title=Desired Title)(memberOf=cn=GroupName,ou=Groups,dc=example,dc=com))" -l "NULL"

此 returns 用户记录是指定组的直接成员(您需要该组的完全限定 LDAP DN,memberOf 不支持通配符 -- 例如名为 "GroupName" 在名为 "Groups" 的 OU 中,位于 example.com AD 的根目录中)。

然后您需要创建一个新组,并将已识别的用户 DN 作为成员。 output.txt 文件将有很多行显示 "changetype: add\n\n" ... 去掉这些行,这样您就得到了 DN。将 "dn: " 更改为 "member: "。将以下信息添加到组成员列表中以创建 LDIF 文件以创建新的全局安全组:

dn: CN=GroupName,OU=Groups,dc=example,dc=com
changetype: add
objectClass: group
cn: GroupName
distinguishedName: CN=GroupName,OU=Groups,dc=example,dc=com
instanceType: 4
name: GroupName
sAMAccountName: GroupName
groupType: -2147483646
objectCategory: CN=Group,CN=Schema,CN=Configuration,dc=example,dc=com
member: CN=Person1,OU=ResourceUsers,dc=example,dc=com
member: CN=Person2,OU=ResourceUsers,dc=example,dc=com
member: CN=Person3,OU=ResourceUsers,dc=example,dc=com
member: CN=Person4,OU=ResourceUsers,dc=example,dc=com
member: CN=Person5,OU=ResourceUsers,dc=example,dc=com

使用以下方法导入 LDIF 文件:

ldifde -i -v -k -y -f output.txt

将使用 "member" 属性中列出的帐户创建并填充该组。

如果您将新人添加到具有所需头衔的第一组,这不会执行任何操作 -- 这是 one-time 快照。您可以轻松地从第二组

中识别出应该 added/removed 的人

需要添加 -- 任何具有所需头衔但不是 CreatedGroupName 成员的 SourceGroupName 成员:

(&(title=Desired Title)(memberOf=cn=SourceGroupName,ou=Groups,dc=example,dc=com)(!(memberOf=cn=CreatedGroupName,ou=Groups,dc=example,dc=com)))

需要删除 -- 不是 SourceGroupName 成员或没有所需头衔的 CreatedGroupName 成员的任何人。

(&(memberOf=cn=CreatedGroupName,ou=Groups,dc=example,dc=com)(|(!(title=Desired Title))(!(memberOf=cn=SourceGroupName,ou=Groups,dc=example,dc=com))))

Add/remove 个来自新组的成员作为个体匹配这两个过滤器之一。