Skip to content

Convert user mailbox to shared mailbox with PowerShell

You want to convert the user mailbox to shared mailbox in Exchange Server/Exchange Online. It’s possible to convert the user mailbox to shared mailbox with several methods. One of them is in the Exchange Admin Center. The other way is to convert the user mailbox to shared mailbox with PowerShell.

Why convert from user to shared mailbox?

Why you want to convert a user mailbox to shared mailbox:

  • You created a user mailbox, but it should be a shared mailbox.
  • You don’t want to license the user mailbox. A shared mailbox has no license/cost attached.

Note: It’s impossible to convert the shared mailbox to user mailbox in Exchange admin center on-premises. This is only possible for cloud mailboxes in Microsoft 365 Exchange admin center. Don’t panic, as PowerShell will get the job done.

Important: If your organization uses an Exchange Hybrid environment, you need to manage your mailboxes using the on-premises Exchange management tools. Follow the article Convert user mailbox to shared mailbox in Exchange Hybrid.

Do you like to have an export of all the user mailboxes and shared mailboxes? Read the article Get mailbox size of all users in Exchange with PowerShell.

Convert to different mailbox type

Do you want to set the mailbox to a different type? The Type parameter specifies the type of the mailbox. Choose one of the valid values:

  • Regular
  • Room
  • Equipment
  • Shared (this article)

Convert user mailbox to shared mailbox

Run Exchange Management Shell as administrator. Run the Set-Mailbox cmdlet and specify the user mailbox. You can fill in the display name or email address of the mailbox. You will not get an output showing that it’s succeeded after running the cmdlet.

[PS] C:\>Set-Mailbox "Boris Campbell" -Type Shared

[PS] C:\>Set-Mailbox "boris.campbell@exoip.com" -Type Shared

Verify converted mailbox type

How do you know if converting the user mailbox to shared mailbox worked? Run the Get-Mailbox cmdlet, and it will show the output. It will show as SharedMailbox, as seen below.

[PS] C:\>Get-Mailbox -Identity "Boris Campbell" | Format-Table Name, RecipientTypeDetails

Name           RecipientTypeDetails
----           --------------------
Boris Campbell        SharedMailbox


[PS] C:\>Get-Mailbox -Identity "Boris.Campbell@exoip.com" | Format-Table Name, RecipientTypeDetails

Name           RecipientTypeDetails
----           --------------------
Boris Campbell        SharedMailbox

Now that we verified the mailbox and everything looks good, we can mark this solved!

Bulk convert user mailbox to shared mailbox

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 the previous step.

What if you have more than a couple of user mailboxes to convert to shared mailboxes? PowerShell is the fastest and most reliable to get the job done.

There are a couple of methods to bulk convert user mailbox to shared mailbox:

  1. CSV file
  2. TXT file

Bulk convert user mailbox to shared mailbox with CSV file

Converting the user mailbox to shared mailbox with a CSV file by following the below steps.

1. Prepare user mailbox CSV file

Start Microsoft Excel and write Email in the left top cell (A1). Write below 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 our example, the mailboxes display name is written.

Convert user mailbox to shared mailbox with PowerShell Excel

Save it as a CSV file in the folder temp on the (C:) drive with the name bulk.csv.

Convert user mailbox to shared mailbox with PowerShell Excel save as CSV file

Open the CSV file with your favorite text editor. For example, the text editor Notepad and have a look that everything looks great.

Convert user mailbox to shared mailbox with PowerShell open CSV file with notepad

After preparing the CSV file, the next step is to read the CSV file content with PowerShell.

2. Check content in CSV file

Run Exchange Management Shell as administrator. Run the Import-Csv 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 shown.

[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

3. Convert mailboxes to shared mailbox with PowerShell script

Time to bulk convert the user mailbox to shared mailbox. Run the below PowerShell script to import the CSV and bulk set mailboxes as shared.

The PowerShell script will show you the following:

  • If a mailbox is not found
  • Already is a shared mailbox
  • Converted to shared mailbox successfully
$MailboxNames = "C:\temp\bulk.csv"

Import-Csv $MailboxNames | foreach {
    $Email = $_.Email
    $Mailbox = Get-Mailbox -Identity $email -ErrorAction SilentlyContinue

    if ($mailbox -eq $null) {
        Write-Host "Mailbox '$email' not found." -ForegroundColor Red
    }
    elseif ($Mailbox.RecipientTypeDetails -eq "SharedMailbox") {
        Write-Host "Mailbox '$Email' is already a shared mailbox." -ForegroundColor Cyan
    }
    else {
        Set-Mailbox -Identity $Email -Type Shared -ErrorAction SilentlyContinue

        $UpdatedMailbox = Get-Mailbox -Identity $Email

        if ($UpdatedMailbox.RecipientTypeDetails -eq "SharedMailbox") {
            Write-Host "Mailbox '$Email' converted to a shared mailbox successfully." -ForegroundColor Green
        }
        else {
            Write-Host "Failed to convert mailbox '$Email' to a shared mailbox." -ForegroundColor Red
        }
    }
}

4. Verify converted mailbox type

Verify that all the user mailbox are 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 TXT file instead of a CSV file, read the next part.

Bulk convert user mailbox to shared mailbox with TXT file

Converting the user mailbox to shared mailbox with a TXT file by following the below steps.

1. Prepare user mailbox TXT file

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.

Convert user mailbox to shared mailbox with PowerShell open text file with Notepad

2. Check content in TXT 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

3. Convert mailboxes to shared mailbox with PowerShell script

Time to bulk convert the user mailbox to shared mailbox. Run the below PowerShell script to import the TXT file and bulk set mailboxes as shared.

The PowerShell script will show you the following:

  • If a mailbox is not found
  • Already is a shared mailbox
  • Converted to shared mailbox successfully
$MailboxNames = Get-Content "C:\temp\bulk.txt"

foreach ($MailboxName in $MailboxNames) {
    $Mailbox = Get-Mailbox -Identity $MailboxName -ErrorAction SilentlyContinue
    
    if ($Mailbox -eq $null) {
        Write-Host "Mailbox '$MailboxName' not found." -ForegroundColor Red
    }
    elseif ($Mailbox.RecipientTypeDetails -eq "SharedMailbox") {
        Write-Host "Mailbox '$MailboxName' is already a shared mailbox." -ForegroundColor Cyan
    }
    else {
        Set-Mailbox -Identity $MailboxName -Type Shared -ErrorAction SilentlyContinue

        $UpdatedMailbox = Get-Mailbox -Identity $MailboxName

        if ($UpdatedMailbox.RecipientTypeDetails -eq "SharedMailbox") {
            Write-Host "Mailbox '$MailboxName' converted to shared mailbox successfully." -ForegroundColor Green
        }
        else {
            Write-Host "Failed to convert mailbox '$MailboxName' to user mailbox." -ForegroundColor Red
        }
    }
}

4. Verify converted mailbox type

It’s good to have a final check and verify that it shows the 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

That’s it!

Which method did you use to convert the user mailbox to shared mailbox?

Conclusion

You learned how to convert user mailbox to shared mailbox with PowerShell. Start Exchange Management Shell or Exchange Online PowerShell and run the commands. After that, verify that the RecipientTypeDetails appears as SharedMailbox.

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 TXT file. Both methods work great.

Did you enjoy this article? You may also like Block sign-in from shared mailboxes. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 11 Comments

  1. Hi Ali,

    When I did this:

    Import-Csv “C:\Users\USERNAME\Downloads\bulk.csv” | foreach {Get-Mailbox -Identity $_.Email} | ft Name, RecipientTypeDetails

    it spit out details on my entire environment and was not restricted to the emails listed in my bulk.csv file. This made me incredibly reluctant to execute a set command as it may set every mailbox in my environment to a shared mailbox.

    Thoughts? Thank you in advance.

  2. 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!

  3. I was wondering if you could do an article with power shell on how we identify O365 the email addresses for cloud mailboxes that haven’t been accessed in say 180 days so we can export them to a csv file and subsequently use the csv to convert the email addresses of the users in the csv to shared mailboxes .

    I would be grateful for your help .

  4. How long can a shared mailbox have mailbox items if there no users delegated to access the shared mailbox?

Leave a Reply

Your email address will not be published. Required fields are marked *