You are migrating mailboxes to Office 365, and the following error message is showing: MigrationPermanentException:…
Bulk convert user mailbox to shared mailbox with PowerShell
We have a project going on, and a lot of user mailboxes need to be a shared mailbox. We showed you how to convert user mailbox to shared mailbox with PowerShell in a previous post. In this article, you will learn how to bulk convert user mailbox to shared mailbox with PowerShell. What’s a better way than using PowerShell to get the job done?
Table of contents
Before you start
There are a couple of ways to bulk convert user mailbox to shared mailbox. One way is with a CSV file, and another way is with a text file. First, you are going to learn how to do it with a CSV file. After that, you will learn how to do it with a text file.
Prepare the user mailbox CSV file
Start Microsoft Excel and write in the left top cell (A1) Email. Write below the cell A1 all the user mailboxes that you like to convert to shared mailbox. Write the display name or the email address of the user mailbox. Both will work when converting the user mailbox. In my example, the display name is written.
Do you like to get all the mailboxes in the organization? Read the article Export a list of mailboxes to CSV in Exchange.
Save it as CSV file in the folder temp on the C: drive with the name bulk.csv.
Open the CSV file with your favorite text editor. For example, the text editor Notepad and have a look. Everything is looking great.
After preparing the CSV file, the next step is to read the CSV file content with PowerShell.
Check the content in CSV file
Run Exchange Management Shell as administrator. Run the following cmdlet to verify that the content is readable in PowerShell.
[PS] C:\>Import-CSV C:\temp\bulk.csv
Email
----
Dylan Piper
Nicola Hunter
Piers Bower
Natalie Mitchell
Richard Grant
You can check the current mailbox type from the CSV file. In our example, different types of mailboxes are showing.
[PS] C:\>Import-CSV C:\temp\bulk.csv | foreach {Get-Mailbox -Identity $_.Email} | ft Name, RecipientTypeDetails
Name RecipientTypeDetails
---- --------------------
Dylan Piper UserMailbox
Nicola Hunter UserMailbox
Piers Bower UserMailbox
Natalie Mitchell UserMailbox
Richard Grant SharedMailbox
Filter only on the user mailbox because these are the mailboxes that we want to convert to shared mailbox.
[PS] C:\>Import-CSV C:\temp\bulk.csv | foreach {Get-Mailbox -Identity $_.Email | Where-Object {$_.RecipientTypeDetails -eq "UserMailbox"}} | ft Name, RecipientTypeDetails
Name RecipientTypeDetails
---- --------------------
Dylan Piper UserMailbox
Nicola Hunter UserMailbox
Piers Bower UserMailbox
Natalie Mitchell UserMailbox
Bulk convert user mailbox to shared mailbox with CSV file
Time to bulk convert the user mailbox to shared mailbox. Run the cmdlet to import the CSV and bulk set mailboxes as shared.
[PS] C:\>Import-CSV C:\temp\bulk.csv | foreach {Get-Mailbox -Identity $_.Email | Where-Object {$_.RecipientTypeDetails -eq "UserMailbox"} | Set-Mailbox -Type Shared}
Verify the result
Verify that all the user mailbox is converted to type shared mailbox.
[PS] C:\>Import-CSV C:\temp\bulk.csv | foreach {Get-Mailbox -Identity $_.Email} | ft Name, RecipientTypeDetails
Name RecipientTypeDetails
---- --------------------
Dylan Piper SharedMailbox
Nicola Hunter SharedMailbox
Piers Bower SharedMailbox
Natalie Mitchell SharedMailbox
Richard Grant SharedMailbox
If you like to use a text file instead of a CSV file, read the next part.
Prepare the user mailbox text file
Converting the user mailbox to shared mailbox with a text file instead of a CSV file looks almost the same. The cmdlets are a bit different.
Place the display names or email addresses of the user mailbox in a text file. Save the text file in C:\temp as bulk.txt. This time Email is not showing at the top, that’s because we don’t need it this time.
Check the content in text file
Run the Get-Content cmdlet, including Get-Mailbox cmdlet to check the current mailbox type.
[PS] C:\>Get-Content C:\temp\bulk.txt | Get-Mailbox | Format-Table Name, RecipientTypeDetails
Name RecipientTypeDetails
---- --------------------
Dylan Piper UserMailbox
Nicola Hunter UserMailbox
Piers Bower UserMailbox
Natalie Mitchell UserMailbox
Richard Grant UserMailbox
Bulk convert user mailbox to shared mailbox with text file
Run the cmdlet to bulk convert user mailbox to shared mailbox. After running the cmdlet and all went great, the output will show you nothing. If it does give you an output with errors, investigate it.
[PS] C:\>Get-Content C:\temp\bulk.txt | Set-Mailbox -Type Shared
Verify the result
It’s good to have a final check and verify that it’s showing type shared mailbox.
[PS] C:\>Get-Content C:\temp\bulk.txt | Get-Mailbox | Format-Table Name, RecipientTypeDetails
Name RecipientTypeDetails
---- --------------------
Dylan Piper SharedMailbox
Nicola Hunter SharedMailbox
Piers Bower SharedMailbox
Natalie Mitchell SharedMailbox
Richard Grant SharedMailbox
Did you bulk convert user mailbox to shared mailbox with CSV file or text file?
Conclusion
In this article, you learned how to bulk convert user mailbox to shared mailbox with PowerShell. It’s faster to set the mailbox in bulk, instead of running the set mailbox one by one. It’s good to know that you can bulk convert user mailbox to shared mailbox with a CSV file or text file. Both will work great.
I hope you enjoyed this article. You may also like Find total number of mailboxes in Exchange. Don’t forget to follow us and share this article.
This is incredibly helpful, Ali – thank you! When doing bulk conversions, is there a way to also set delegations (ex. Full Access Administrator) for each account concurrently using same .csv file? Thanks again!
Is there any way by which we can check the live details that mail box is converted or not.
I want to see the result on the spot while command is running.
bla bla SharedMailBox
Bla bla sharedmailbox
Or
Bla Bla completed
bla bla completed
Hi, Will this work for Office 365? Thank Asta
Yes, it works for Exchange on-premises and Exchange Online (Microsoft 365/Office 365).
I used txt method and it worked fab… Thanks a ton..
Glad it worked out.