Knowledge Base

How To Programmatically Get List of Exchange Servers in the Org

Article ID: 186333

Article Last Modified on 7/2/2004


APPLIES TO


This article was previously published under Q186333

SUMMARY

To programmatically get a list of the Exchange Servers in an Exchange Organization you can use the BatchExport function of Directory Application Programming Interface (DAPI). There is sample code found on the BackOffice SDK and MSDN called DSExport, which you can use as a template.

MORE INFORMATION

Once you have the project and executable made, the command line to run the sample code that generates the list of Exchange servers in the Exchange Organization should like the following (all text should be on the same line):
   dsexport /file=d:\output.txt /dsa=ServerName /server=""
      /classes=Computer /basepoint=/o=ORGName  /subtree
The generated output file has a header line followed by one line for each server in the Organization. It looks similar to the following, without the line wrapping:

Obj-Class,First Name,Last name,Display Name,Alias Name,Directory Name,Primary Windows NT Account,Home-Server,E-mail address,E-mail Addresses,Members,Obj-Container,Hide from AB Computer,,,,,ServerName,,,,,,/ou=YOUCAN/cn=Configuration/cn=Servers, Computer,,,,,CAMARO,,,,,,/ou=CENTER_ICE/cn=Configuration/cn=Servers,

If you do not want to use an output file, you can specify the parameter ExportCallback, which is a structure containing a pointer to a function that is called on each exported item. The sample code does not implement this feature of the BatchExport command.

Additional query words: kbDSupport kbEDK kbMAPI DAPI kbdse

Keywords: kbhowto kbfaq KB186333