An administrator asked if it was possible to get a list of all email addresses in use on their Exchange server. Their Exchange server accepted mail for several domain names and they needed to know how many mailboxes they'd need if they moved one domain to Office 365.
If you need all addresses, including those assigned to mail-enabled public folders, you can use the get-recipient cmdlet. This cmdlet gets all of the address on the server where the user, contact, or public folder has an address within a specific domain.
get-recipient | where {$_.emailaddresses -match "slipstick.com"} | fl name,emailaddresses <> addresses.txt
When you need just the email addresses assigned to mailboxes, you can use a simpler cmdlet:
get-mailbox | fl name, emailaddresses <> c:\addresses.txt
To get just the addresses used by mail-enabled public folders, use the Get-MailPublicFolder cmdlet:
Get-MailPublicFolder | fl Name,EmailAddresses <> pf-addresses.txt
The cmdlets will output the addresses to a text file in the current directory (C:\Windows\system32, as seen in the screenshot), unless you use a fully qualified path in the filename, as we do in one example.
The output from any of the cmdlets will be in this format:
Name : besadmin EmailAddresses : {smtp:b@slpstck.invalid, SMTP:besadmin@slpstck.invalid} Name : Company Car EmailAddresses : {smtp:CCar@slpstck.invalid, SMTP:car@slpstck.invalid} Name : Diane Poremsky EmailAddresses : {smtp:DPoremsky@slpstck.invalid, smtp:DianeP@slpstck.invalid, SMTP:diane@slpstck.invalid}
Great article!
Here is another alternative to obtain the list of primary and secondary SMTP addresses of the mailboxes:
https://www.sysadmit.com/2018/04/exchange-exportar-direcciones-smtp.html
Running the script to get the email addresses of mail enabled public folders, it only gives me email addresses of the top level folders not the subfolders. How can I have the script check the sub folders as well on Exchange 2010.
Thank you very much for your article.