Reputation: 19880
How can I list available ADSI (Active Directory Service Interfaces) service providers in C#?
Upvotes: 1
Views: 628
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
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