Get All Active Email Addresses on Exchange Server 2013/2010/2007

Friend of mine asked me if I can help him out with his Exchange Server 2013 so that he can find out how many active email addresses are there, and can we produce a list of it or not. So I have helped him with the following resources:

Get-Recipient @ Technet: http://technet.microsoft.com/en-us/library/aa996921%28v=exchg.150%29.aspx

This is particularly important if you want to migrate all the on-prem exchange active accounts to Office 365 or Exchange Online.

If you need all addresses, including those assigned to mail-enabled public folders, you can use the get-recipient cmdlet. This cmdlet retrieves all of the addresses on the server where the user, contact, or public folder has an address within a specific domain, here mobs-bd.org. The command follows:

get-recipient | where {$_.emailaddresses -match “mobs-bd.org”} | fl name,emailaddresses >> activemailaddresses.txt

Above command will get the recipient names from the domain “mobs-bd.org” and the “>>” will export the results to the file “activemailaddresses.txt” in the default directory where you are running the command from.

When you need just the email addresses assigned to mailboxes, you can use a simpler cmdlet:

 Command to be issued:
get-mailbox | fl name, emailaddresses >> c:\emailaddressesonmailbox.txt

To get just the addresses used by mail-enabled public folders, use the Get-MailPublicFolder cmdlet:

 Command to be issued:
Get-MailPublicFolder | fl Name,EmailAddresses >> pfenabledaddresses.txt
 More information on Get-MailPublicFolder: http://technet.microsoft.com/en-us/library/bb124772%28v=exchg.150%29.aspx

getrecipient

The cmdlets will output the addresses to a text file in the current directory (C:\Windows\system32, as seen in the screenshot and the first issued command), unless you use a data path in the file name, as I did in other examples.

NOTE: I have expunged the domain name and the IP addresses of the site, as well as the exported file-names which holds domain information.