简体   繁体   English

如何从Active Directory筛选特定的OUS

[英]How to filter specific OUS from Active Directory

I'm trying to get a list of users from specific OU's. 我正在尝试从特定的OU获取用户列表。

The root is COMPANY then USERS , and then there are several OU's after that, say 10. I want to only grab the users from 5 out of the 10 OU's. 根是COMPANY然后是USERS ,然后是几个OU,例如10。我只想从10 OU中的5个中抓住用户。

How can I accomplish this? 我该怎么做?

  Dim ou As String = "OU=dept1,OU=Users,OU=COMPANY,DC=COMPANY,DC=local"

I want to add dept2 to 5 in that string. 我想在该字符串中将dept2添加到5。 It doesn't work. 没用 I can only do 1 OU at a time. 一次只能执行1 OU。 How can I filter 5 dept out of 10 under the OU users? 如何在OU用户中过滤出10个单位中的5个单位?

As far as I know there is no way to do that other than running 5 separate searches. 据我所知,除了运行5个单独的搜索外,没有其他方法可以执行此操作。

You can achieve similar results if the users in the different OUs are members of different groups (at least one unique group per OU). 如果不同OU中的用户是不同组的成员(每个OU至少一个唯一组),则可以实现类似的结果。 Then it will be possible to do it with a single search. 然后,只需一次搜索就可以做到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM