TN.
TN.

Reputation: 19880

How to list available ADSI (Active Directory Service Interfaces) service providers?

How can I list available ADSI (Active Directory Service Interfaces) service providers in C#?

Upvotes: 1

Views: 628

Answers (2)

tretyak
tretyak

Reputation: 80

Microsoft has an KB-233023 on this topic: How To Find All ADSI Providers on a System

another variant:

    public static IEnumerable<string> GetAdsiProviders()
    {
        var providers = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\ADs\Providers");
        if (null == providers) yield break;

        foreach (var name in providers.GetSubKeyNames())
        {
            yield return name + ":";
        }
    }

Upvotes: 0

TN.
TN.

Reputation: 19880

I have found that:

foreach (object obj in (IEnumerable)Marshal.BindToMoniker("ADs:"))
{
    obj.GetType().InvokeMember("Name", BindingFlags.DeclaredOnly | 
        BindingFlags.Public | BindingFlags.NonPublic | 
        BindingFlags.Instance | 
        BindingFlags.GetProperty, null, obj, null).Dump();
}   

Upvotes: 1

Related Questions