简体   繁体   English

将Active Directory用户和组导入SQL Server(可能通过c#)

[英]Importing Active Directory Users and Groups into SQL Server (possibly via c#)

I need to import all ad groups in a few OUs into a table in SQL Server 2008. Once I have those I need to import all the members of those groups to a different table. 我需要将几个OU中的所有广告组导入到SQL Server 2008中的表中。一旦我有了这些,我需要将这些组的所有成员导入到不同的表中。 I can use c# to do the work and pass the data to SQL server or do it directly in SQL server. 我可以使用c#来完成工作并将数据传递给SQL服务器或直接在SQL服务器中执行。

Suggestions on the best way to approach this? 有关最佳方法的建议吗?

Add a Linked Server to your SQL Server and query the Active Directory via LDAP queries. 将链接服务器添加到SQL Server并通过LDAP查询查询Active Directory。 This here described this quite well: 这里很好地描述了这个:

Create a SQL Server View of your AD Users, Brendan Tompkins (MVP) 创建AD用户的SQL Server视图,Brendan Tompkins(MVP)

Arry, 哈利,

I don't know exactly, but found some links that may help you. 我不确切知道,但找到了一些可能对你有帮助的链接。 I think the hottest track is this expression: 我认为最热门的曲目就是这样的表达:

"(&(objectCategory=Person)(memberOf=DN=GroupName, OU=Org, DC=domain,
DC=com))"

I found it in LDAP Query for group members on a ColdFusion community's site. 我在LDAP查询中找到了ColdFusion社区网站上的组成员 I'm more or less sure the filter can easily be applied to your query. 我或多或少地确定过滤器可以轻松应用于您的查询。 I'm sorry, but I cannot test it, because I have no AD around here. 对不起,我无法测试,因为我周围没有AD。

This one could also be a bit (but less) interesting: 这个也可能有点(但不那么)有趣:

http://forge.novell.com/pipermail/cldap-dev/2004-April/000042.html http://forge.novell.com/pipermail/cldap-dev/2004-April/000042.html

Hope this helps, cheers, 希望这有助于,欢呼,

Matthias 马蒂亚斯

As the OP of this question seemed open to other technologies (3 years ago), I posted a walk through that uses SSIS as the technology for querying AD for users, writing those users to a table and doing group lookups on those users. 由于这个问题的OP似乎对其他技术开放(3年前),我发布了一篇文章,其中使用SSIS作为向用户查询AD的技术,将这些用户写入表并对这些用户进行组查找。 Active Directory SSIS Data Source Even if you aren't interested in SSIS, the LDAP query for source objects and the C# for group membership might be handy for anyone reviewing this question. Active Directory SSIS数据源即使您对SSIS不感兴趣,对于查看此问题的任何人来说,对源对象的LDAP查询和组成员身份的C#都可能很方便。

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

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