Exporting email addresses (and other stuff) from Exchange

csvde (CSV Directory Exchange) seems to ship with MS Exchange, so should be on anything running it.
Syntax is:

  1. csvde -f <file> -d "<dn>" -r (mailname=*) -l [properties] -p subtree</dn></file>

Where:
<file> is the csv file to dump the output to.
<dn> is the dn of the OU you want the data from (the 'd' in csvde is the same as the one in ldap).
[properties] are the properties you want to export. They're field names in the csv file.
-p specifies the seach scope (I used subtree, alternatives are Base and OneLevel)

There's also the -j logfile option which I couldn't make work. But I'm so amazing I didn't need it.