You want to create mailboxes in Exchange Online and use Office 365. Before you can…
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.
1 2 3 4 5 6 7 8 9 |
[PS] C:\>Import-CSV C:\temp\bulk.csv Name ---- 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.
1 2 3 4 5 6 7 8 9 |
[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.
1 2 3 4 5 6 7 8 |
[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.
1 |
[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.
1 2 3 4 5 6 7 8 9 |
[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.
1 2 3 4 5 6 7 8 9 |
[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.
1 |
[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.
1 2 3 4 5 6 7 8 9 |
[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.
I used txt method and it worked fab… Thanks a ton..