使用“SQL”查询 Active Directory?

发布于 2024-07-05 07:28:45 字数 295 浏览 11 评论 0原文

我只是想知道是否有人知道或制作了 Active Directory 的包装器以便能够在 .net 中轻松查询它? 有点像“LINQ-to-ActiveDirectory”或某些 SQL 方言,即能够执行“SELECT DISTINCT(DEPARTMENT) FROM /Users/SomeOU/AnotherOU”或“SELECT user FROM domain”或其他操作。

据我所知,可以以“SQLesque”方式查询WMI和IIS,我只是想知道Active Directory是否也可以进行类似的操作,而无需学习另一种查询语言(LDAP)?

I just wonder if anyone knows or made a wrapper around Active Directory to be able to easily query it in .net? Kind of like "LINQ-to-ActiveDirectory" or some SQL Dialect, i.e. to be able to do "SELECT DISTINCT(DEPARTMENT) FROM /Users/SomeOU/AnotherOU" or "SELECT user FROM domain" or whatever.

As far as I know, it is possible to query WMI and IIS in a "SQLesque" way, i just wonder if something similar is possible for Active Directory as well, without having to learn yet another Query Language (LDAP)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丑丑阿 2024-07-12 07:28:45

LINQ to Active Directory 实现了
自定义 LINQ 查询提供程序,允许
查询 Active Directory 中的对象。
在内部,查询被翻译
进入 LDAP 过滤器并发送至
服务器使用
系统目录服务.NET
框架库。

http://www.codeplex.com/LINQtoAD

示例(来自网站):

// NOTE: Entity type definition "User" omitted in sample - see samples in release.

var users = new DirectorySource<User>(ROOT, SearchScope.Subtree);
users.Log = Console.Out;

var res = from usr in users
          where usr.FirstName.StartsWith("B") && usr.Office == "2525"
          select new { Name = usr.FirstName + " " + usr.LastName, usr.Office, usr.LogonCount };

foreach (var u in res)
{
    Console.WriteLine(u);
    u.Office = "5252";
    u.SetPassword(pwd);
}

users.Update();

LINQ to Active Directory implements a
custom LINQ query provider that allows
querying objects in Active Directory.
Internally, queries are translated
into LDAP filters which are sent to
the server using the
System.DirectoryServices .NET
Framework library.

http://www.codeplex.com/LINQtoAD

Sample (from the site):

// NOTE: Entity type definition "User" omitted in sample - see samples in release.

var users = new DirectorySource<User>(ROOT, SearchScope.Subtree);
users.Log = Console.Out;

var res = from usr in users
          where usr.FirstName.StartsWith("B") && usr.Office == "2525"
          select new { Name = usr.FirstName + " " + usr.LastName, usr.Office, usr.LogonCount };

foreach (var u in res)
{
    Console.WriteLine(u);
    u.Office = "5252";
    u.SetPassword(pwd);
}

users.Update();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文