Thursday, June 19, 2008

Extracting email address from Exchange....

I've got a call from Messaglabs to update our email address that are allowed to send emails through their system. They are trying to decrease the possibility of a dictionary attack which will scan an entire domain with made up words and send emails to any and every address in that domain. So to help keep the company secure I've had to stop what I was doing to attend to this matter ASAP.

So how does one get all the valid emails out of Exchange 2003? Well you'd think it was as simple and right click and export right? WRONG! Exchange 2003 does not allow you to export all of your email address in the manner that you think. There may be some 3rd party tool but who wants to go through all of that.

Here is a simple solution that I found that works great. You'll need Windows support tools for ADSIEdit installed on your DC's (the one you'll run this command on)

First go to a global catalog server and run ADSIEdit (if that does not work you don't have the support tools and you'll need to download them - they are apart of 2003 SP1)

1.run ADSIEdit
2.expand the doamin to see the OU's
3.right click on the OU you are trying to get the addresses from (we are talking about the OU that has all or most of the users and groups with email addresses)
4a.go to properties
4b.on the left field you are looking for the distinguishedName
5.click edit and copy the entry
6.paste this to notepad - it should read OU=YourOUname,DC=yourDomainName,DC=com
example
UO = abc
domain = xyz

OU=abc,DC=xyz,DC=com

7. go to the command prompt on the same server and type

csvde -f c:\addresseslist.csv -d "OU=abc,DC=xyz,DC=com" -r (mailnickname=*) -l mailnickname,proxyaddresses -p subtree

edit whats in bold to accommodate your environment.

8. no go to the C:\ drive and import the .cvs file into excel.

All done. You'll need to make sure the excel import wizard runs so you can set the perameters so that it's easy to extract the email address.

1 comment:

Anonymous said...

Nice work, but there is an easier solution for keeping an up to date e-mail address database with Message Labs.

Log into Client Net, there hidden under configuration > email > platform > tools you'll find the "Address Synchronization Tool".

That beautiful piece of software does the work for you. Granted, setting it up is a bit tricky but since I set it up for our company it runs like a charm.

Just invoke it once per night and it''ll do all the work for you and even drop you an email with what it has done exactly.

I really recommend checking it out

best regards,
Holger