In this Tutorial we are going over two simple methods to create reports to list SMTP address. The first section will cover how to list all primary SMTP addresses, and then how to list all addresses in any given user. We will be using both Exchange Admin Center and Exchange Management Shell.
There are several ways to retrieve information from Exchange, before we start the process to create the reports using both administrative tools available.
We will use Exchange Admin Center, and then click on recipients and then mailbox double click on any given mailbox and go to the email address tab. If we check on the right side we will have a list of all SMTP Addresses of the current user, the list may contain SMTP, SIP (Skype for Business/Lync), and X400/X500 (legacy protocols).
Listing all Primary SMTP Addresses
This is the simplest report that we can create, the reason being is that the Primary SMTP address (also known as reply-address) exists in two different attributes of any given user.
Using Exchange Admin Center, click on recipients and then on mailboxes, a list of all mailboxes will be listed, click on … and then click on Export data to a CSV file.
In the new window, select the fields and for this exercise the 3 defaults ones are fine, and then click on Export. A file will be downloaded in your browser, open it and we will have all columns selected on the file, as shown in the figure below.
In order to do the same thing using Exchange Management Shell, just run the following cmdlet to list the users in the console:
Get-Mailbox | ft sAMAccountName,PrimarySMTPAddress –AutoSize
If a file is required, then we need to make a few changes on the cmdlet to get the file in a readable format, as follows:
Get-Mailbox | Select samaccountname,primarysmtpaddress | export-csv C:\PrimarySMTP-Report.csv –NotypeInformation
Listing all addresses…
In the previous section we covered the primary SMTP Address, which is easier than listing all the existent SMTP address of any given user.
We can use Exchange Admin Center using the same process that we have just done in the previous example, but at this time we can add the column Email addresses and that will result on an additional column on the file. The only small issue is that all addresses will be part of that column and they will be separated by a comma.
In order to visualize the same type of information using Exchange Management Shell we can use this cmdlet below, we added two additional columns (PrefixString to identify which type of adddress which could be SMTP, SIP, X400/X500 and so forth; IsPrimaryAddress if it is set to Yes then we know that is the reply-address for the user).
Get-Mailbox | Select samaccountname –ExpandProperty EmailAdddresses | ft samaccountname,AddressString,PrefixString,IsPrimaryAddress –AutoSize
In order to export we need to make a few adjustments on the cmdlet as listed below.
Get-Mailbox | Select sAMAccountName –ExpandProperty Emailaddress | Select sAMAccountName,AddressString,PrefixString,IsPrimaryAddress | Export-CSV C:\AllAddresses.txt –NoTypeInformation
Note: If your organization has more than 1000 accounts, then the parameters –ResultSize:XX where XX is the limit of objects to be retrieved should be used in the Get-Mailbox portion of the cmdlet.