Sorry for being sick with people, all this is very new :(
We already had a lot of help, but it seems that I do not see a problem, I am trying to fill out a list box with all the current units, and then send each machine within this unit. off. (Acquiring AD OU and OU in Active Directory) were my previous Q.
string defaultNamingContext;
DirectoryEntry rootDSE = new DirectoryEntry("LDAP://RootDSE");
defaultNamingContext = rootDSE.Properties["defaultNamingContext"].Value.ToString();
DirectoryEntry entryToQuery = new DirectoryEntry ("LDAP://" + defaultNamingContext);
MessageBox.Show(entryToQuery.Path.ToString());
DirectorySearcher ouSearch = new DirectorySearcher(entryToQuery.Path);
ouSearch.Filter = "(objectCatergory=organizationalUnit)";
ouSearch.SearchScope = SearchScope.Subtree;
ouSearch.PropertiesToLoad.Add("name");
SearchResultCollection allOUS = ouSearch.FindAll();
foreach (SearchResult oneResult in allOUS)
{
comboBox1.Items.Add(oneResult.Properties["name"][0]);
}
I went through and debug everything that I know, the search engine does not collect any results, so why is nothing populated in the list box.
source
share