skip to Main Content

List all SMTP addresses with PowerShell

Sometimes you want to list all SMTP addresses in Exchange Server. You need that list to gather information because you want to bulk remove secondary SMTP addresses from the mailboxes. The SMTP with an upper case is the primary email address and the smtp with a lower case is the secondary email address also known as the alias address. The email addresses are configured as proxy addresses in Active Directory. In this article, you will learn how to list all SMTP addresses with PowerShell.

Find SMTP addresses in Exchange Admin Center

Log into Exchange Admin Center and go to the properties of a mailbox. Click email address on the menu. In this field, you can view the email addresses of each mailbox. You can add, change, or delete an email address. See the image below, there are two SMTP email addresses configured for the user.

List all SMTP addresses with PowerShell email address

Find SMTP addresses in Active Directory

Start Active Directory Users and Computers, after that enable Advanced Features. Go to the user object properties and click on the attribute editor tab. Find the attribute proxyAddresses. The same two SMTP email addresses are shown as values, just like we saw earlier in the Exchange Admin Center.

List all SMTP addresses with PowerShell ProxyAddresses

You have seen the SMTP addresses in both places. How to get a list of all the mailboxes including their SMTP addresses? Read more about it in the next part.

List all primary SMTP addresses

Run Exchange Management Shell as administrator. Run the cmdlet to list the mailboxes with the primary SMTP address.

In our Exchange organization, we have more than one email address for the same mailbox. In the next part, we will list those secondary email addresses.

List all SMTP email addresses

In the previous part, we listed the primary SMTP address of every mailbox in the Exchange organization. Now we like to have a list including the secondary SMTP addresses. How will we add this to the existing PowerShell cmdlet?

We are going to make use of the script block. A script block is a collection of statements or expressions that can be used as a single unit. By using that, it will gather all the SMTP email addresses. Note that the SMTP is written in lower case letters because it’s not the primary SMTP. The Primary SMTP is written in upper case letters.

Export the results to CSV file

Export the results to a CSV file in the path C:\temp. Open the file with Microsoft Excel or any other application that you are are using.

I hope it helped you!

Conclusion

In this article, you learned how to list all SMTP addresses in Exchange Server with PowerShell. Run the cmdlet as shown in the article to get a list of the mailboxes with SMTP addresses. Export the list to CSV and go through it with Microsoft Excel.

Did you enjoy this article? You may also like Complete mailbox migration with bad items. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect and IT Consultant. His specialism is designing and building complex enterprise environments. He started Information Technology at a very young age, and his goal is to teach and inspire others. Connect with ALI TAJRAN on social media. Read more »

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top