4

I'm trying to gather a list of all e-mail addresses being used by our Exchange 2003 system, which includes not only the normal user addresses, but distribution groups and aliases as well. I also need the output formatted like: user@domain.com - although, we only have one domain, so even if I can get the user part, that would work.

I don't care about account-association here, I really just need a list of addresses.

How can I go about doing an export of all smtp e-mail addresses from Exchange 2003, including distribution group and alias addresses in the user@domain.com format?

I would prefer something that can be accomplished via the command line so that it can be generated by a script, but it would be just as useful if there is a way to do this manually (read: point and click) as well.

Any ideas? I don't see anything within System Manager that can do this, and my searching isn't turning up anything that can fulfill all the above requirements.

Solved

This is how I'm using the accepted answer:

@echo off

ldifde -f c:\temp\ldifde-dump.txt -l proxyaddresses
find "@" < c:\temp\ldifde-dump.txt > c:\temp\email-addresses.txt
del c:\temp\ldifde-dump.txt

This produces c:\temp\email-addresses.txt, which, although it contains a little extra garbage characters, it can easily be parsed out with a search & replace in Notepad++.

Cypher
  • 1,079
  • 2
  • 17
  • 24

2 Answers2

4

If you only need primary email addresses, you can run this on your Exchange server, filling in the domain and com values:

csvde -r "(mail=*)" -d "dc=domain,dc=com" -l mail -f c:\gal.csv

To get secondary email addresses, its a bit trickier. You can use this to generate a file:

ldifde -f dump.ldf -l proxyaddresses

Found a method to extract the email addresses from the LDF file here: http://bytes.com/topic/unix/answers/648158-extract-email-addresses-big-file

If you have access to perl within Windows, make a perl file that contains this:

while (<STDIN>) { 
while (/[\w\.\-]+@[\w\.\-]+\w+/g) 
    {print "$&\n"}} 

Then run this command:

perl ExtractEmail.pl <dump.ldf >out.txt

Out.txt should contain all your email addresses.

Jeff Miles
  • 2,020
  • 2
  • 19
  • 26
  • Hrm, Perl is a no-go - server is on the DMZ, but the ldifde command helps a lot. Thanks. – Cypher Dec 01 '10 at 22:31
  • For those with grep but no perl you can always do something like `grep -oP "[\w\._-]+@[\w_]+\.[\w]{2,5}" dump.ldf > emails.txt`. Obviously the regex could be expanded as needed, but that fit for my org's relatively straightforward addressing scheme. – s.co.tt May 24 '16 at 18:05
0

Adfind.exe with this: AdFind.exe -default -nodn -nolabel -noctl proxyAddressess

Chop out all of the SMTP: or smtp: addresses.

http://www.joeware.net/freetools/tools/adfind/index.htm

ax25
  • 231
  • 1
  • 2