Question

I have performed an active directory search and now have a SearchResultCollection of all the users in active directory. I've specified all the properties that the DirectorySearch should load, but I also want to know what OU (distinguished name) each user is in. I know I could figure it out be getting a DirectoryEntry for each user, and look at the distinguished name of the directory entries parent directory entry, but this seems like it would be terribly slow. Is it possible to return the ou distinguished name some other way?

Was it helpful?

Solution

Subtring-after the first comma?

cn=bob, ou=someOU,dc=this,dc=that

would seem to be your goal.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top