User Tools

Site Tools


exchange:reporting_project:query_notes

LDAP

All Exchange Mailboxes

The Exchange System Manager uses the “displayName” attribute, not common name, therefore, the displayName must be included in the initial lookup. I think three fields is fine, CN, DN, displayName…

The base query to get all Exchange mailboxes is:

(&(&(& (mailnickname=*) (| (&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*))) ))))

Csvde

Csvde format for this query to retrieve CN's and displayNames:

csvde -f all_exchange.txt -r "(&(&(& (mailnickname=*) (|(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*))) ))))" -l cn,displayName

Output of that query is simple to parse, and looks like:

DN,cn
"CN=102 Philosophy,OU=SIS,DC=ais,DC=columbia,DC=edu",102 Philosophy,102 Philosophy

Queries required

All users with exchange mailboxes

csvde -f all_exchange.txt -r "(&(&(& (mailnickname=*) (| (&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*))) ))))" -l cn

Output: List of DNs,CNs. Process: Output insert statements for DNs and CNs Process: Output insert statements for OU

Manual export of CN with mailbox size from System Manager Process: Output update statements with mailbox size where CN=CN.

Common Name

CN and DN are used universally throughout LDAP and Microsoft's AD infrastructure, including Exchange Server 2003 System Manager. The DN is more specific, and should be used for the unique identifier of an object. The CN is easier to parse, and can be used in a lot of cases.

The simplest LDAP lookup for a Common Name looks like:

(cn=102 Philosophy)

Multiple CN's can be looked up via the OR operator, “!”, as such:

(!(cn=102 Philosophy)(cn=Ben Hall))
exchange/reporting_project/query_notes.txt · Last modified: 2009/12/11 11:53 by ben