列出在Debian 9中使用MONO的Active Directory计算机

时间:2018-09-30 23:59:11

标签: active-directory mono ldap debian

以下代码在Windows 10独立计算机(未加入域)上运行

    static void Main(string[] args)
    {

        using (DirectoryEntry entry = new DirectoryEntry(@"LDAP://myDomain.local"))
        {
            entry.Username = "Mydomain\\administrator";
            entry.Password = "xxxxxxxxxxx";
            entry.AuthenticationType = AuthenticationTypes.Secure;

            using (DirectorySearcher mySearcher = new DirectorySearcher(entry))
            {
                mySearcher.Filter = ("(objectClass=computer)");
                mySearcher.PropertiesToLoad.Add("name");
                foreach (SearchResult resEnt in mySearcher.FindAll())
                {
                    if (resEnt.Properties["name"].Count > 0)
                    {
                        Console.WriteLine((string)resEnt.Properties["name"][0]);
                    }
                }
            }
        }
        Console.WriteLine("Press any key to exit.");
        Console.ReadKey();
    }

在Debian上运行Mono时,“ entry”对象已成功连接到AD,并且似乎已成功创建了搜索器对象。但是我在FindAll方法和FindOne方法上都收到了一个“未实现”异常。

您拥有DS但无法搜索对象对我来说没有任何意义?为什么未开发的方法会出现在monodevelop intellisense中?所以我必须做错事!对? 但是,如果实际上未实现Find方法,则将对任何替代方法提出建议。
为了简洁起见,我只是想在Raspberry Pie 3B上获取域计算机的列表-尝试了不同的Linux风格,Java,Windows 10 IOT ...在这方面似乎都没用。沮丧。

0 个答案:

没有答案