LDAP 路由/连接
LDAP Routing / Connection
如果我在域 example1.com 上并且想查询 example2.com[=24 的 AD 目录中的用户=] 使用 LDAP 连接字符串 LDAP://DC=example2, DC=com 连接是如何建立的?
是从客户端应用程序到 example1.com 的 DC 的 LDAP 连接,然后是两个域之间的 DC 到 DC 连接以代理查询还是 LDAP在 example2.com?
中直接从客户端应用程序连接到 DC
我在 C# 中使用 DirectorySearcher 组件时遇到一些连接问题,我怀疑它可能试图直接连接到目标域的 DC 而不是其本地直流.
我希望这是有道理的。
这里有两种情况,您可以根据自己的情况找到解决方案
理论上,如果域在同一个林中,您应该从全局目录中获取用户专有名称 (DN)。 GC 具有林中所有域的部分(只读)副本。理论上,您会指定 GC: 提供程序而不是 LDAP: 提供程序,并让系统 select 最好的 GC。您不必指定 DC。拥有 DN 后,如果域受信任,您应该能够绑定到对象并修改它(如果您有权限)。
也可以用Get-ADUser _-Server DOMAINCONTROLLER -credential $NULL_ -filter {samaccountname -eq $SourceAccount} | Set-ADUser -Enabled $True
来完成
-server 属性指向域控制器,-credential $NULL 将提示输入其他域中的域管理员 ID 以供使用。
关于 cross-forest/cross-domain 目录 query/access 场景。
您可能需要确保两个域(您当前的域和要查询数据的目标域)具有双向信任关系。以下是一些讨论类似主题的网络文章和话题:
#跨林 LDAP 查询和子域。
http://social.technet.microsoft.com/Forums/windowsserver/en-US/6257f7d1-5a07-4652-af0c-4550ddffe1c3/cross-forest-ldap-query-and-sub-domains
#在 C# .NET 中使用 LDAP 跨多个域查询组和用户
http://jokecamp.wordpress.com/2012/03/26/querying-groups-and-users-across-multiple-domains-with-ldap-in-c-net/
cross-forest/crosss-domain 查询的一个常见错误是未在查询的搜索库中正确指定完整域名。
Example: two domains domain1.com, domain2.com. The common mistake is
to query domain1.com for users by sepecifying "DC=COM" as the search
base in the LDAP query....thinking that the query will simply look in
both domain1 and domain2, this is not the case. This is a mistake
because DC=COM does not actually exist on a partition, only
DC=domain1,DC=com and DC=domain2,DC=com exists. The thing to
remember is that even though you are querying users from another domain
(not on the DC you are directing the query to), you must specify that
full domain as the search base, just like you would to without it
being cross-forest/domain. What make it a cross-forest/domain query is
the fact that you are not going to correct DC.
如果我在域 example1.com 上并且想查询 example2.com[=24 的 AD 目录中的用户=] 使用 LDAP 连接字符串 LDAP://DC=example2, DC=com 连接是如何建立的?
是从客户端应用程序到 example1.com 的 DC 的 LDAP 连接,然后是两个域之间的 DC 到 DC 连接以代理查询还是 LDAP在 example2.com?
中直接从客户端应用程序连接到 DC我在 C# 中使用 DirectorySearcher 组件时遇到一些连接问题,我怀疑它可能试图直接连接到目标域的 DC 而不是其本地直流.
我希望这是有道理的。
这里有两种情况,您可以根据自己的情况找到解决方案
理论上,如果域在同一个林中,您应该从全局目录中获取用户专有名称 (DN)。 GC 具有林中所有域的部分(只读)副本。理论上,您会指定 GC: 提供程序而不是 LDAP: 提供程序,并让系统 select 最好的 GC。您不必指定 DC。拥有 DN 后,如果域受信任,您应该能够绑定到对象并修改它(如果您有权限)。
也可以用
来完成Get-ADUser _-Server DOMAINCONTROLLER -credential $NULL_ -filter {samaccountname -eq $SourceAccount} | Set-ADUser -Enabled $True
-server 属性指向域控制器,-credential $NULL 将提示输入其他域中的域管理员 ID 以供使用。
关于 cross-forest/cross-domain 目录 query/access 场景。
您可能需要确保两个域(您当前的域和要查询数据的目标域)具有双向信任关系。以下是一些讨论类似主题的网络文章和话题:
#跨林 LDAP 查询和子域。
http://social.technet.microsoft.com/Forums/windowsserver/en-US/6257f7d1-5a07-4652-af0c-4550ddffe1c3/cross-forest-ldap-query-and-sub-domains#在 C# .NET 中使用 LDAP 跨多个域查询组和用户
http://jokecamp.wordpress.com/2012/03/26/querying-groups-and-users-across-multiple-domains-with-ldap-in-c-net/cross-forest/crosss-domain 查询的一个常见错误是未在查询的搜索库中正确指定完整域名。
Example: two domains domain1.com, domain2.com. The common mistake is to query domain1.com for users by sepecifying "DC=COM" as the search base in the LDAP query....thinking that the query will simply look in both domain1 and domain2, this is not the case. This is a mistake because DC=COM does not actually exist on a partition, only DC=domain1,DC=com and DC=domain2,DC=com exists. The thing to remember is that even though you are querying users from another domain (not on the DC you are directing the query to), you must specify that full domain as the search base, just like you would to without it being cross-forest/domain. What make it a cross-forest/domain query is the fact that you are not going to correct DC.