Dec 26 2017 08:52 PM
Dec 26 2017 08:52 PM
1. We currently run Azure AD Connect with our 2011 server to Sync with Office 365.
I have a shared mailbox that somehow has the default Microsoft email address as the primary email address.
I have tried many powershelgl commands but I cant seem to correct it.
Can someone please recommend the MSonline module command to set the primary email address on a shared mailbox
Primary is currently: email@example.com > should be firstname.lastname@example.org
Dec 27 2017 01:22 AM
I guess you have to use Exchange online cmdlets
How to connect to Exchange online:
change mailbox address:
Dec 27 2017 01:30 AM
Thanks for the reply.
I don't think the Powershell for AD connect uses that cmdlet:
I am using the following:
I tried Set-Mailbox -Identity oldEmail@domain.com -EmailAddresses newEmail@domain.com
It does not recognise the command Set-Mailbox.
Dec 27 2017 01:44 AM
it's because MsOnline powershell module does not contain Set-Mailbox cmdlet.
To view all the available cmdlets that are available in MsOnline module you can enter in powershell
get-command -Module msonline
Dec 27 2017 01:50 AM
Yes you are correct, and I can not see a command to change the primary email on a shared mailbox
I can use Set-MsolUserPrincipalName but it only changes the value on a user not a shared mailbox
Can I use the Exchange cmdlet to connect to Office 365 and use other commands?
Dec 27 2017 02:20 AM
Even using the Exchange Powershell I get an error but it is being synced with Azure AD Connect (formerly Azure AD Sync)
I have attached a screenshot of the error.
Dec 27 2017 03:46 AM
Well I can see that you have Exchange on-premises. What primary SMTP address is set in Exchange? Are you able to change email address via ECP?
As from error message it says that you have to change this internaly, afterwards changes should be synced to cloud
Dec 27 2017 03:58 AM
We don't use an onsite exchange server any more.
I [solved] it by doing the following:
** - REMOVE USERS: (caution back up .pst offline emails first)
1. Move the AD user on your local server into a No sync folder
2. Sync the AD with Start-ADSyncSyncCycle -PolicyType Delta
3. This will put the AD user on Office 365 into the recycling bin.
4. Get-MsolUser -ReturnDeletedUsers
Then permanantly delete the user:
5. Remove-MsolUser –UserPrincipalName email@example.com -RemoveFromRecycleBin
6. Move the AD user back into the SYNC folder and force a sync
** - FORCE SYNC NOW
7. Start-ADSyncSyncCycle -PolicyType Delta
8. Check the Office 365 Portal > Done.
Thanks for your assistance.