Quickly add an email address to Exchange Online with PowerShell

With the little PowerShell script described here, you can quickly add an email address to your Exchange Online account in Office 365. This allows you to easily create throwaway email addresses. Note that the script requires PowerShell 3.0.

Michael PietroforteMVP By Michael Pietroforte - Tue, April 16, 2013 - 2 comments google+ icon

Michael Pietroforte is the founder and editor of 4sysops. He is a Microsoft Most Valuable Professional (MVP) with more than 30 years of experience in system administration.

I recently moved some of my mailboxes from Gmail to Exchange Online, mostly because the false positive rate of Gmail’s spam filter became unacceptable. I am now quite happy with this change. It is not just that Exchange Online harmonizes better with Outlook. I also like the PowerShell interface, which gives me more flexibility with managing mailboxes and email addresses.

The little PowerShell script I share in this post is a good example. I use it whenever I quickly need a new email address. In the past, I always used a special email address for signing up for online services or for news services, or when a software vendor traded a download for an email address. This method is no longer manageable.

Email address trading has become a lucrative business. There are just too many companies craving my email address. Often it is quite cumbersome to unsubscribe, and sometimes I receive “product news” from vendors I have never heard of. Thus, whenever I subscribe now to a new service, I use a dedicated email address just for this service provider. If I am no longer interested in the service, and if there is no unsubscribe link in their emails, I just delete the email address in Exchange Online.

You can, of course, add a new email address in the Office 365 web interface. However, I don’t want to click through several pages just to create a throwaway email address. With this tiny PowerShell script, I just have to enter the email address I want to use for the service and I am ready to receive all kinds of valuable information.

The script is so simple that I don’t really need to explain it. Before you launch it, you have to add the name of your Exchange mailbox in the first line. After you start the script, you will be asked for the email address you want to add and for your credentials. The script then establishes a connection to Exchange Online and adds the email address.

Add email address to Exchange Online with PowerShell

Add email address to Exchange Online with PowerShell

To verify that the email address was added, the script loads the mailbox information and searches for the new email address in the array of your secondary email addresses. After this, the script disconnects your session.

The last two lines are just for ensuring that the PowerShell console doesn’t close before you verified that everything worked as expected. Depending on the speed of your Internet connection, you might have to wait a little until the script finishes adding the address.

Have you authored a useful PowerShell script that you would like to share with 4sysops readers? Please drop me a note. If the script is good, you will be rewarded.

-1+1 - Rate this post
Loading ... Loading ...
Disclaimer
Your question wasn't answered? Please ask in the new 4sysops forum!

2 Comments- Leave a Reply

  1. I use shared logins from bugmenot.com or a throwaway e-mail adress from a service like 10minute mail.

  2. Christian, thanks for the tip. I often actually want to receive emails from those services for which I create throwaway emails. I just don’t want to dependent on their cooperation if I decide to leave. It also interesting to see what they do with your email address. In those cases where I just want to download something and not to “be bugged” again, I just use a yahoo account where I only log on if I have to confirm the email address.

Please share your thoughts in a comment!

Login

Lost your password?