Try using the Directory export built into exchange. You will need to create a csv file with the correct headers to use during the export. All your info will be available to use for your queries.
Try these headers in a csv file.
Coffee
Headers for dir. exports.
Obj-Class,Delivery-Mechanism,Directory Name,Admin
Note,First Name,Last Name,Display Name,Alias Name,Allow
rich text,AutoReply,AutoReply-Message,Can send on behalf
of,Deliv-Ext-Cont-Types,Department,E-mail
Addresses,Secondary-Proxy-Addresses,Fax number,Hide from
AB,Home-Server,Alternate Recipient,Members,Mobile
number,Notes,Obj-Container,Obj-Dist-Name,Obj-
Users,Office,Outgoing message size limit,Pager number,Phone
number,Primary Windows NT Account,Security-
Protocol,Title,Trust level,Use IS defaults