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

时间:2022-09-17 21:42:48

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. I can use c# to do the work and pass the data to SQL server or do it directly in SQL server.

我需要将几个OU中的所有广告组导入到SQL Server 2008中的表中。一旦我有了这些,我需要将这些组的所有成员导入到不同的表中。我可以使用c#来完成工作并将数据传递给SQL服务器或直接在SQL服务器中执行。

Suggestions on the best way to approach this?

有关最佳方法的建议吗?

3 个解决方案

#1


3  

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. 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.

我在LDAP查询中找到了ColdFusion社区网站上的组成员。我或多或少地确定过滤器可以轻松应用于您的查询。对不起,我无法测试,因为我周围没有AD。

This one could also be a bit (but less) interesting:

这个也可能有点(但不那么)有趣:

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

Hope this helps, cheers,

希望这会有所帮助,干杯,

Matthias

#2


8  

Add a Linked Server to your SQL Server and query the Active Directory via LDAP queries. This here described this quite well:

将链接服务器添加到SQL Server并通过LDAP查询查询Active Directory。这里描述得很好:

Create a SQL Server View of your AD Users, Brendan Tompkins (MVP)

创建AD用户的SQL Server视图,Brendan Tompkins(MVP)

#3


1  

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. 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.

由于此问题的OP似乎对其他技术开放(3年前),我发布了一篇文章,其中使用SSIS作为向用户查询AD的技术,将这些用户写入表并对这些用户进行组查找。 Active Directory SSIS数据源即使您对SSIS不感兴趣,对于查看此问题的任何人来说,对源对象的LDAP查询和组成员身份的C#都可能很方便。

#1


3  

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. 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.

我在LDAP查询中找到了ColdFusion社区网站上的组成员。我或多或少地确定过滤器可以轻松应用于您的查询。对不起,我无法测试,因为我周围没有AD。

This one could also be a bit (but less) interesting:

这个也可能有点(但不那么)有趣:

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

Hope this helps, cheers,

希望这会有所帮助,干杯,

Matthias

#2


8  

Add a Linked Server to your SQL Server and query the Active Directory via LDAP queries. This here described this quite well:

将链接服务器添加到SQL Server并通过LDAP查询查询Active Directory。这里描述得很好:

Create a SQL Server View of your AD Users, Brendan Tompkins (MVP)

创建AD用户的SQL Server视图,Brendan Tompkins(MVP)

#3


1  

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. 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.

由于此问题的OP似乎对其他技术开放(3年前),我发布了一篇文章,其中使用SSIS作为向用户查询AD的技术,将这些用户写入表并对这些用户进行组查找。 Active Directory SSIS数据源即使您对SSIS不感兴趣,对于查看此问题的任何人来说,对源对象的LDAP查询和组成员身份的C#都可能很方便。