2

Exchange Server に関する詳細情報を取得するために使用される LDAP クエリについて知りたいと思っていました。データ可用性グループ、それらに関する統計、レプリケーション ステータスなどについて詳しく知りたいと思っています。CmdLets がいくつかあることは知っていますが、PowerShell の使用は避けたいと考えています。

Exchange Server の Active Directory から同じ情報を取得する方法を知りたいです。

4

1 に答える 1

0

いいアイデアですね!

それはすべて、次の構成パーティションにあります。

CN=Microsoft Exchange、CN=サービス、CN=構成、DC=xx、DC=xx.

以下の C# コードは、サーバーの役割を取得するためのもので、作業を開始するのに役立ちます。

ロール情報は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();
    }
于 2013-01-08T20:28:44.457 に答える