如何使用 AD 中的 LDAP 查询从 MS Exchange Server 2010 获取 DAG 信息?

发布于 2024-12-19 18:22:00 字数 182 浏览 3 评论 0原文

我想了解用于获取有关 Exchange Server 的更多信息的 LDAP 查询。 我有兴趣了解更多有关数据可用性组、相关统计数据和复制状态等的信息。 我知道有一些 CmdLets,但我想避免使用 PowerShell。

我想知道从 Exchange Server 的 Active Directory 获取相同信息的任何可能方法。

I wanted to know about LDAP Queries used to get more information about Exchange Server.
What I am interested in knowing more about Data Availability Groups, Statistics Regarding them and Replication Status etc.
I know there are some CmdLets but I want to avoid using PowerShell.

I want to know any possible way of getting same info from Active Directory for Exchange Server.

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

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

发布评论

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

评论(1

白芷 2024-12-26 18:22:00

这是一个很酷的主意!

一切都在配置分区中:

CN=Microsoft Exchange、CN=服务、CN=配置、DC=xx、DC=xx。

下面的 C# 代码将检索服务器角色,应该可以帮助您入门。

角色信息来自此处

        using (DirectoryEntry de = new DirectoryEntry("LDAP://RootDSE"))
        {
            var NamingContext = de.Properties["configurationNamingContext"][0];
            using (DirectoryEntry de_NC = new DirectoryEntry("LDAP://" + NamingContext))
            {
                using (DirectorySearcher ds = new DirectorySearcher(de_NC))
                {
                    ds.PropertiesToLoad.Add("cn");

                    ds.Filter = "(&(objectCategory=msExchExchangeServer)(msExchCurrentServerRoles:1.2.840.113556.1.4.803:=2))";
                    Output("Mailbox Role Servers:", ds, "cn");

                    ds.Filter = "(&(objectCategory=msExchExchangeServer)(msExchCurrentServerRoles:1.2.840.113556.1.4.803:=4))";
                    Output("CAS Role Servers:", ds, "cn");

                    ds.Filter = "(&(objectCategory=msExchExchangeServer)(msExchCurrentServerRoles:1.2.840.113556.1.4.803:=16))";
                    Output("Unified Messaging Role Servers:", ds, "cn");

                    ds.Filter = "(&(objectCategory=msExchExchangeServer)(msExchCurrentServerRoles:1.2.840.113556.1.4.803:=32))";
                    Output("Hub Transport Role Servers:", ds, "cn");

                    ds.Filter = "(&(objectCategory=msExchExchangeServer)(msExchCurrentServerRoles:1.2.840.113556.1.4.803:=64))";
                    Output("Edge Transport Role Servers:", ds, "cn");
                }
            }
        }


    static void Output(string Titel, DirectorySearcher ds, string Property)
    {
        Console.WriteLine(Titel);
        SearchResultCollection src = ds.FindAll();
        foreach (SearchResult RoleServer in src)
        {
            Console.WriteLine(RoleServer.Properties[Property][0].ToString());
        }
        if (src.Count < 1)
            Console.WriteLine("---");

        Console.WriteLine();
    }

That's a cool idea!

It's all there in the configuration partition under:

CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=xx,DC=xx.

The C# code below will retrieve the server roles, and should help get you started.

The Role info comes from here.

        using (DirectoryEntry de = new DirectoryEntry("LDAP://RootDSE"))
        {
            var NamingContext = de.Properties["configurationNamingContext"][0];
            using (DirectoryEntry de_NC = new DirectoryEntry("LDAP://" + NamingContext))
            {
                using (DirectorySearcher ds = new DirectorySearcher(de_NC))
                {
                    ds.PropertiesToLoad.Add("cn");

                    ds.Filter = "(&(objectCategory=msExchExchangeServer)(msExchCurrentServerRoles:1.2.840.113556.1.4.803:=2))";
                    Output("Mailbox Role Servers:", ds, "cn");

                    ds.Filter = "(&(objectCategory=msExchExchangeServer)(msExchCurrentServerRoles:1.2.840.113556.1.4.803:=4))";
                    Output("CAS Role Servers:", ds, "cn");

                    ds.Filter = "(&(objectCategory=msExchExchangeServer)(msExchCurrentServerRoles:1.2.840.113556.1.4.803:=16))";
                    Output("Unified Messaging Role Servers:", ds, "cn");

                    ds.Filter = "(&(objectCategory=msExchExchangeServer)(msExchCurrentServerRoles:1.2.840.113556.1.4.803:=32))";
                    Output("Hub Transport Role Servers:", ds, "cn");

                    ds.Filter = "(&(objectCategory=msExchExchangeServer)(msExchCurrentServerRoles:1.2.840.113556.1.4.803:=64))";
                    Output("Edge Transport Role Servers:", ds, "cn");
                }
            }
        }


    static void Output(string Titel, DirectorySearcher ds, string Property)
    {
        Console.WriteLine(Titel);
        SearchResultCollection src = ds.FindAll();
        foreach (SearchResult RoleServer in src)
        {
            Console.WriteLine(RoleServer.Properties[Property][0].ToString());
        }
        if (src.Count < 1)
            Console.WriteLine("---");

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