In my recent post about configuring DNS for Office 365, I mentioned that Microsoft creates mailboxes in the form of email@example.com. I outlined the steps for adding so-called “vanity” domains, after which additional (proxy) email addresses can be specified but any outbound messages will still be sent from the onmicrosoft.com address (at least, that’s what’s used in the beta – I guess that may change later in the product’s lifecycle).
It is possible to change the primary address for a user (e.g. I send mail using an address on the markwilson.co.uk domain) but it does require the use of PowerShell. Time to roll up your sleeves and prepare to go geek!
Connecting to Office 365 from Windows PowerShell
I was using a Windows 7 PC so I didn’t need to update any components (nor do Windows Server 2008 R2 users); however Windows XP SP3, Server 2003 SP2, Server 2008 SP1 or SP2 and Vista SP1 users will need to make sure they have the appropriate versions of Windows Powershell and Windows Remote Management installed.
Once PowerShell v2 and WinRM 2.0 are installed, the steps to connect to Office 365 were as follows:
Prompt for logon credentials and supply the appropriate username and password:
Create a new session:
Import the session to the current PowerShell console:
At this point, the session import failed for me because script execution was disabled on my machine. That was corrected using
Set-ExecutionPolicy -ExecutionPolicy unrestricted (although that’s not a great idea – it would be better to use a lower level of access) – I also had to run PowerShell as an administrator to successfully apply that command.
Once scripts were enabled, I was able to import the session.
List the current mailbox addresses
It’s possible that a mailbox may have a number of proxy addresses already assigned, so this is the code that I used to list them:
If you want to format the list of mailboxes as a single comma-separated line, then this might help:
`b is a backspace escape character.)
Set the primary email address
The primary email address is shown using an upper case SMTP: prefix whereas proxy addresses use a lower case smtp: prefix.
To change the primary email address, it’s necessary to reset all addresses on the mailbox with the
Set-Mailbox cmdlet. This is where some copying/pasting of the output from the previous command may help:
Disconnect the session from Office365
Once all changes have been made, it’s good practice to break down the session again: