答案 0 :(得分:1)
我发现:
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();
}
答案 1 :(得分:0)
Microsoft在此主题上有一个KB-233023:How To Find All ADSI Providers on a System
另一种变体:
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 + ":";
}
}