【发布时间】:2015-01-12 18:29:08
【问题描述】:
在我的应用程序中,我需要获取 Active Directory 林并列出域层次结构。
我获得了具有必要权限的 Active Directory 帐户。但是我的开发计算机不在域中,无法添加到域中。
这是我用来获取森林并访问根域的代码:
// I also tried to add a Global Catalog port: 192.168.2.11:3268, no success
DirectoryContext dc = new DirectoryContext(
DirectoryContextType.Forest, "192.168.2.11", “Login1”, “pass1”);
Forest f = Forest.GetForest(dc);
Console.WriteLine("Forest name: " + f.Name);
Console.WriteLine("Root domain: " + f.RootDomain);
如果我在不在域中的计算机上运行它,如何修改它以发现域?
【问题讨论】:
标签: c# authentication active-directory windows-authentication directoryservices