Background: The Active Directory Users & Computers (ADUC) UI lets you list the mail column for each object, which displays the default (SMTP) email address for objects. You can export the list from ADUC to a CSV/txt file. However, any additional email addresses in the proxyAddresses attribute are not exported.
There’s no GUI interface (in ADUC or ESM) to list or export all email addresses. Here’s a script to do that – ListEmailAddresses.vbs.
File: ListEmailAddresses.zip
Download link updated to non-HTTPS.
What does it exactly do?
- Queries Active Directory for Contacts & Groups
- Lists their email addresses
- Queries Users
- Lists enabled users’ email addresses
- Lists disabled users’ email addresses separately (was required for a certain project I did a long time back)
- Outputs to command line and also to a text file – c:\proxyaddresses.txt
– X.400 addresses are ignored
{ 40 comments… read them below or add one }
← Previous Comments
U da man!!!
Thanks for the info! This is what I needed!
I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.
Thank you,
Paige
i get an error on line 54 char 13 anyone know why
Last anonymous – see the comment from December 11, 2009 from Traderbob.nc
You likely have a user or group name with a "/" in it. The line from the above comment must be added at line 54 and again at line 101.
It is a right useful script. I do need to hack at it to get it to enumerate public folders and other Exchange Recipient objects.
Great script. Amazing that Exchange Management Console doesn't offer this (and other equivalent) functionality.
Thank you so much, it was a great help!!!
Here's the condition I used to get only the PRIMARY e-mails:
If Left (ProxyAddress,5) = "SMTP:" Then
strResult = strResult & VbCrlf & proxyAddress
AddressCount = AddressCount + 1
End If
Thank you!!
http://www.santosalves.com
Ricardo, Where did you insert the code you used to filter for only primary? I tried putting it just before the text file gets created but that didn’t work, although I received no error.
Hi there fantasic blog and script, I have no idea regarding scripting, I have looked into the code to see if I could modify it but it really isnt clear for me! I need to add atleast the ‘Title’ attribute from the organisation tab in AD and it would be great if I could also add the ‘Department’ and ‘Company’ attributes to the output, per user. If it is fairly straigh forward to do could somebody post the amended code or point me in the direction of which sections need modifying to do this. Thanks very much and have a great weekend. Keith
The mailbox which i disabled is not showing in the Disconnected mailboxes. I have checked the settings under: Mailbox Database Properties -> Limits -> Keep deleted mailboxes for(Days)=30. Can’t figure out how the mailbox disappeared. Now, I want the mailbox as needs to refer to very important emails from it. Can Anyone help…. please?????? Jose Fernz…
Great script. Unfortunately it only returns a bit under 500 results for me, and we have much more than that here…
There are no errors though…
great little script. saved hours of work.
Don’t suppose you know of a utility to globally change users passwords in AD by taking info from a pre-selected list
THANK YOU!!!! I needed a list of email addresses to import. This worked like a champ.
Is it possible in list to add size of email?
greate script
http://exchangepedia.com/2005/09/how-to-export-all-email-addresses-from-a-domain.html
Hi,
Thanks for this interesting and helpful script!
What are the lines i have to edit to get email address.
if my domain is ‘mydomain.com’
i change line 54
“LDAP://mydomain.com/”& strUserDN & “”
i change line 100
set objUser= GetObject(“LDAP://mydomain.com/”& strUserDN & “”)
but still it gives error message that
‘The specified domain either does not exit or …”
please help
Suneth, you shouldnt need to edit the script. just download and extract. Run on the server and then close the script output window. On the root of the c drive you should see a text file called proxyaddresses.txt open this and you should see the list of the users with email addresses listed under them.
When SMTP is in CAPS this shows that it is the primary SMTP mail address.
Awesome script… Taking it one step further… Could this be used in conjunction with something else to take any disabled users with an email address and CLEAR it out…… We are running into an issue with disabled users retaining their email address even though their mailbox was deleted. That is messing up our Mimecast.
Thanks in advance…
You rock dude!
Awesome script, saved much time.
Thanks for your work
Thank you! Just what I needed :-)
Hi Every one im not like u guys… i assigned work to pull up 960 users email address from AD and update them in Excel file.. can any one help me how to get there email address in a easy way inspite of pulling every ones account and copy the email address…
And users are from diff locations and account/ domains..from US
The size limit for this request was exceeded
The script returns the above error. This is a very large domain in excess of 40,000 users. Any way to modify the script to return more results?
When I run your script I get a Windows Script Host error. It says:
Line: 158
Char: 6
Error: The size limit for this request was exceeded
Code: 80072023
Source: Provider
Do you have how to get your script to download the whole directory?
I have the same question about Line 158, char: 6. Any fix for this?
Pretty new to this, so I’m sure I’m doing something wrong. I downloaded this script, copied it to my domain controller and double clicked it. Nothing happened…no errors, no proxyaddresses.txt on the C:\ How am I supposed to run this script exactly?
Open a command window (Start > Run > Cmd), use CSCRIPT to run a script (or you can also set default script execution engine to CSCRIPT).
can anyone suggest any solution/software, by which i’ll be able to get email addresses from certain domains? not such email address generators which only generates emails from hotmail or yahoo….such as, if i’d like to generate email address, which are associated with http://www.smsi.se ….any idea will be welcome.
Hi
I am trying to download the script but server is timing out…can you please email or send us another link to download
Sandeep: the link redirects you to the https (secure) version of Exchangepedia. Just remove the ‘s’ from ‘https’ and it’ll download fine.
I have put a link up as I needed the file as well. Lucky I still had it on another server.
http://www.layer3.net.nz/files/AddressList.zip
Cheers.
Hi im very interested to hiring somebody else, to help me to set this script as i want. please send me an email to [email protected]
What a fantastic tool!
Makes migration much easier.
eeemail.net – exports all email contacts and all email addresses ever met at your mailbox (gmail, yahoo , etc ). free
Hi,
Thanks for this interesting and helpful script!
nice script!! Did exactly what i needed and it still works. Just be sure to put the file in the root of the c:\ so that it can create the necessary .txt file in that same location
When I run your script I get a Windows Script Host error. It says:
Line: 79
Char: 6
Error: The size limit for this request was exceeded
Code: 80072023
Source: Provider
Do you have how to get your script to download the whole directory?
@Berra, This is pretty old and written in VBScript. You should be using PowerShell on current systems.
Either way, just search for the error on Bing/Google and you’ll find instructions/script block you can add to this script to set a higher query limit.
If you’re using PowerShell, it’s much easier.
{ 3 trackbacks }