Quantcast
Viewing latest article 2
Browse Latest Browse All 2

Querying LDAP in C# to get list of computers

I am working with LDAP in my Windows Forms C# project.

I created a CheckListBox, and started to create a method that queries the Active Directory for all my computers is the environment.

The method is:

public string ComputerList(){        DirectoryEntry rootDSE = new DirectoryEntry("LDAP://MyDomain.Local");        DirectorySearcher computerSercher = new DirectorySearcher(rootDSE);        computerSercher.PageSize = 10000;        computerSercher.Filter = "(&(objectClass=computer))";}

I am also have as I said, a CheckListBox.

What I want to do is to have a result for the query and every computer that founds. add it to the Items property for the CheckListBox.

But I don't how even approach the result. it's not like PowerShell that gives you a list of objects...

Thank you


Viewing latest article 2
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>