• Facebook
  • RSS Feed
  • Instagram
  • LinkedIn
  • Twitter
Apr 212010
 

Today I was asked to provide an LDAP query which would list all the Exchange Servers in a domain.  My LDAP is rusty, because I just don’t use it enough to keep it fresh in my mind.  Rather than spending all day with LDP and trying to fathom it out, there is a nifty little way of doing it that I remember from a long time ago.

In Exchange System Manager for Exchange 2003, create a new global address list, and for the filter rules, build the query you want eg :

Under FIND: choose “Custom Search”, then under “Custom Search”, choose the fields you want eg choose Exchange Server, then Name, then Starts With, and then *.  Click on Add to add it your conditions list, and now click on Find Now.

You should get a list of the Exchange Servers.

Click Ok, and exit the dialog for the new address list.  Now go to the properties of your address list, and on the General tab you’ll see the Filter Rules written out as an LDAP query :

(&(objectCategory=msExchExchangeServer)(cn=*))

You can then test it out using LDP, or similiar.  Remember if your base is the top level of your domain, you’ll need to search SUBTREE rather than 1 level.

In addition another little gotcha is that it is often better to bind to a GC, rather than a DC>  In fact the objectCategory query above ONLY returns results on a GC.

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)