SOLVED

Exchange Online - Change primary email address, name and alias of a shared mailbox

Brass Contributor

Hi All,

 

I have been asked by HR to change the email address, name and alias of a few shared mailboxes that were set up last year. For example, I need to change "jobs-mathssec@domain.com" into "jobs-maths@domain.com", and the name/alias consequently. I need to do the same for 9 other mailboxes which have "sec" in the email address.

Is it safe to run the following command:

 

set-mailbox jobs-mathssec@domain.com -EmailAddress "SMTP:jobs-maths@domain.com","smtp:jobs-maths@domain.onmicrosoft.com" -Name jobs-maths -DisplayName jobs-maths -Alias jobs-maths

 

Will the old name stay in other properties? I would need to keep all the old emails sent to the old address.

Thank you in advance for your help!

5 Replies
best response confirmed by fstorer (Brass Contributor)
Solution

When changing the primary SMTP address, it's usually a good idea to keep the old one as secondary, to avoid unnecessary NDRs. So in the syntax you used, make sure to add it as well, or you can use the -WindowsEmailAddress parameter:

 

Set-Mailbox user -WindowsEmailAddress newuser@domain.com

 

which basically changes the primary address to the value you specify, while preserving the old one as secondary. Then do the rest of the attributes as needed.

Thank you @Vasil Michev for your help!

I will add that parameter to the script! 

@Vasil Michev Hi, I currently have the same task but when I run the script, I get the error message: "Set-Mailbox: A parameter cannot be found that matches parameter name 'WindowsEmailAddress'."

 

I also tried -EmailAddresses but still not recognizing...This is the script:

Connect-ExchangeOnline
Set-Mailbox random.dude -WindowsEmailAddress Email address removed

Can you please tell me if I miss a module or anything? 
I would really appreciate! :)

@raphi_1303 

 

That's really strange. The WindowsEmailAddress is such an old parameter that even if you had an older module (or the on-prem module), you should still see it.

 

After running Connect-ExchangeOnline, get the temporary name of the imported Exchange Online module using:

 

Get-Module -Name tmp_*

 

Then, check for known instances of the Set-Mailbox command using:

Get-Command -All Set-Mailbox

 

You should find just one reference, with the "Source" column value being that of the temporary module from the first command (i.e. it'll look something like "tmp_dgzmuyzr.zi3", though the actual value changes with every new Exchange connection.)

 

If you have more than one module then that may offer some clues on why you're getting that error.

 

If you only see just one result and it's the temporary Exchange module then you can run the following to see if the WindowsEmailAddress parameter is listed. If it is, then I really have no idea what is going on in your case.

 

It should be listed right at the end of the list:

 

(Get-Command Set-Mailbox -ShowCommandInfo).ParameterSets.Parameters.Name | Sort-Object

 

Cheers,

Lain

Don't use the Preview module, or at least make sure to read the release notes before doing so :)
In other words, you need to connect via:

Connect-ExchangeOnline -UseRPSSession
1 best response

Accepted Solutions
best response confirmed by fstorer (Brass Contributor)
Solution

When changing the primary SMTP address, it's usually a good idea to keep the old one as secondary, to avoid unnecessary NDRs. So in the syntax you used, make sure to add it as well, or you can use the -WindowsEmailAddress parameter:

 

Set-Mailbox user -WindowsEmailAddress newuser@domain.com

 

which basically changes the primary address to the value you specify, while preserving the old one as secondary. Then do the rest of the attributes as needed.

View solution in original post