Many administrators need to convert regular User Mailboxes to a Shared Mailbox after migration to Office 365. While the task is not very complex in itself, it is admittedly quite boring and you need to remember quota sizes and not least the syntax for removing the license.
I’ve put together a small script that will automate this task given two command line arguments in the format:
.\convertUserToShared.ps1 <email@example.com> <sec-gr-shared-mailbox-name>
Remember to assign an email address to the security group or you won’t be able to use it in Exchange Online. You may also want to hide it from the address book (set attribute: msExchHideFromAddressBook to True).
Now, to be able to perform the necessary operations you need the following plug-ins:
- Microsoft Online Services Sign-In Assistant: http://www.microsoft.com/en-us/download/details.aspx?id=39267
- Windows Azure AD Module: http://technet.microsoft.com/library/jj151815.aspx
And I really recoomend upgrading Powershell as well:
- Powershell 3.0: http://www.microsoft.com/en-us/download/details.aspx?id=34595
Connect to Exchange Online AND Office 365 with the following syntax prior to running the script:
I’ve commented directly in the source where needed, so the script should be fairly self explanatory:
If you’re synchronizing your accounts with Active Directory using DirSync (or FIM), please make sure that the following attributes are set on the modified Shared Mailbox objects in Active Directory:
msExchRemoteRecipientType = 100
msExchRecipientTypeDetails = 34359738368 (Optional but will set correct Remote Mailbox type on-prem)
If these attributes are not set correctly, you will risk that DirSync converts the cloud object back to a regular mailbox.
If you can make a regex that will do the job of line 22, you will be credited on this page! 🙂