I haven't done it lately, but I would assume you can bind to the root and iterate the children looking for OU objects. You could also create a query that searches the domain for objectClass of organizationalUnit and then add each of the ones you find to the application nodes.
An example ldap query that would do it would be: (&(objectClass=organizationalUnit)(objectCategory=CN=Organizational-Unit,CN= Schema,CN=Configuration,DC=root_domain,DC=com)) Ask for just the names or the DN's to be returned. LDAP dialect is more familiar to me than SQL, but I would imagine either could be done. Al -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stelley, Douglas Sent: Monday, March 07, 2005 11:07 AM To: [email protected] Subject: [ActiveDir] OU's listed Is there a way to query Active Directory and return all OU's? perhaps a SQL query? I can use "dsquery ou" I suppose, but I'm writing a .net that can be a front end for our help desk in easing simple user management tasks. I have a hard coded version, but I'd like to have a query that will return all available OU's in a drop down select box for user moves within this domain. Thanks Doug Stelley This time, like all time, is a very good one if we but know what to do with it. - Ralph Waldo Emerson Confidentiality Notice: The information contained in this message may be legally privileged and confidential information intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any release, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error please notify the author immediately by replying to this message and deleting the original message. Thank you. List info : http://www.activedir.org/List.aspx List FAQ : http://www.activedir.org/ListFAQ.aspx List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
