Get all AD groups in one OU
Posted on 2013-12-20
I'm trying to query Active directory using VB.Net on .Net Framework 3.5
I need to get all security groups in a specific OU.
Dim searcher As New DirectorySearcher()
searcher.Filter = "(&(Objectcategory=group)(OU=ThisIsTheOUThatIWant,OU=Groups,OU=SecondLevel,OU=CompanyLevel))"
It's not working. I get 0 results. I tried variations but none works.
I have not written code at all in the last 5 years - only started again now in the last week.
Please help me to get this working.