Skip to content

Remove mailbox without deleting user in Microsoft 365

If a user in your organization no longer needs their mailbox, you can remove it and keep the user active. This will permanently delete the mailbox and all its content, such as messages, calendars, and notes of the existing user. It will preserve the user account and all the associated data and services, such as Teams, OneDrive, and SharePoint files. In this article, you will learn how to remove a mailbox without deleting a user in Microsoft 365.

Remove mailbox without deleting user

In our example, we have a cloud-only organization. We want to remove all the information from a mailbox but keep the user account (Ken Walker) active. This means that the user can still sign into other Microsoft services and apps.

To remove the mailbox without deleting a user in Microsoft 365, you need to follow the below steps.

1. Connect to Exchange Online PowerShell

To run the PowerShell commands specified in the current article, you must Connect to Exchange Online PowerShell.

Connect-ExchangeOnline

2. Remove Exchange Online license

To remove the Exchange Online license from a mailbox, follow the below steps:

  1. Sign in to Microsoft 365 admin center
  2. Click Users > Active users
  3. Click on the user mailbox
Remove mailbox without deleting user in Microsoft 365 admin center
  1. Click Licenses and apps
  2. Click Apps
Remove licenses and apps of user mailbox in Microsoft 365 admin center
  1. Clear the checkbox Exchange Online Plan 2
  2. Click Save changes

Note: If you assigned the user Microsoft 365 licenses with group-based licensing, you must remove the user from the group. Then you can remove the direct licenses from the user.

Remove licenses and apps of user mailbox in Microsoft 365 admin center
  1. You can get an Error when removing the Exchange Online license

In our example, we get the below error and must remove Microsoft Defender for Office 365 (Plan 2) and Microsoft MyAnalytics (Full) licenses as well.

To assign a license that contains Microsoft Defender for Office 365 (Plan 2), you must also assign one of the following service plans: Exchange Online (Plan 2). To assign a license that contains Microsoft MyAnalytics (Full), you must also assign one of the following service plans: Exchange Online (Plan 2).

Remove Exchange Online (Plan 2) license error in Microsoft 365 admin center
  1. Clear the checkbox of the other licenses to remove them as well
  2. Click Save changes
Successfully removed licenses and apps of user mailbox in Microsoft 365 admin center

Once you remove the licenses of the user, you can delete the mailbox in the next step.

3. Check user mailbox

To check if the user mailbox is deleted, run the below Get-Mailbox PowerShell command.

Get-Mailbox "Ken.Walker@m365info.com"

The PowerShell output shows the output below, meaning it can’t find the user mailbox because you removed the licenses.

Get-Mailbox: Ex6F9304|Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException|The operation couldn't be
performed because object 'Ken.Walker@m365info.com' couldn't be found on 'GV1PR02A11DC004.EURPR02A011.PROD.OUTLOOK.COM'.

You can also check if the user mailbox is deleted in the Exchange admin center.

  1. Sign in to Exchange admin center
  2. Click Recipients > Mailboxes
  3. Verify the user can’t be found in the list
Verify user mailbox is deleted in Exchange admin center

4. Permanently clear previous mailbox info

We will use the Set-User PowerShell cmdlet with the -PermanentlyClearPreviousMailboxInfo parameter to remove the mailbox from the user.

Important: The Exchange Online mailbox will be permanently deleted and is unrecoverable.

Run the below PowerShell command to delete the cloud mailbox permanently.

Set-User -Identity "Ken.Walker@m365info.com" -PermanentlyClearPreviousMailboxInfo 

The PowerShell output below appears. Type Y followed by Enter.

Confirm
Are you sure you want to perform this action?
Delete all existing information about user Identity:'Ken.Walker@m365info.com'?. This operation will clear existing  
values from Previous home MDB and Previous Mailbox GUID of the user. After deletion, reconnecting to the previous   
mailbox that existed in the cloud will not be possible and any content it had will be unrecoverable PERMANENTLY.    
This operation will also create an async task to purge all the mail data. You can check the status by running       
'Get-User <Identity> | fl *Workload*' and check if DesiredMailboxWorkloads is set to null. Do you want to continue? 
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

It removes the mailbox from the user (Ken.Walker@m365info.com) without deleting the user. This means the user can still sign in to other Microsoft apps and services, such as OneDrive and Microsoft Teams, with all the data intact.

Note: If you want to Delete a user in Microsoft 365, it will remove the user account, including the mailbox, Microsoft Teams, and all other services. You can also permanently Force delete a Microsoft 365 mailbox with PowerShell.

5. Verify mailbox deleted permanently

Let’s verify that the mailbox has been deleted successfully.

Run the below PowerShell command to check if the DesiredMailboxWorkloads value is empty.

Get-User "Ken.Walker@m365info.com" | fl *Workload*

The PowerShell output shows the below results.

MailboxWorkloads                   : Mail, Calendar, Contacts, Substrate
DefaultMailboxWorkloadsMask        : Mail, Calendar, Contacts, Substrate
DesiredMailboxWorkloads            : Substrate
DesiredMailboxWorkloadsModified    : 03/02/2024 23.35.16
DesiredMailboxWorkloadsGracePeriod : None

The DesireMailboxWorkloads is set to Substrate, but it must be empty (null) before the mailbox is completely deleted.

Note: You need to wait up to 24 hours for the changes to occur.

Run the PowerShell command again and check if the DesiredMailboxWorkloads value is null.

MailboxWorkloads                   : Mail, Calendar, Contacts, Substrate
DefaultMailboxWorkloadsMask        : Mail, Calendar, Contacts, Substrate
DesiredMailboxWorkloads            : 
DesiredMailboxWorkloadsModified    : 
DesiredMailboxWorkloadsGracePeriod : 

The mailbox is successfully deleted, but the user account stays active in the Microsoft 365 admin center.

  1. Click Users > Active users
  2. Click on the user (Ken Walker)
  3. Click Mail
  4. Verify the below message appears We are preparing a mailbox for the user

When you want to reassign the mailbox to the user, you must understand that the user mailbox data is empty without any previous data. There are no messages in their Inbox, Deleted Items, Calendar, or Junk email.

That’s it!

Read more: Manage Microsoft 365 users recycle bin »

Conclusion

You learned how to remove a mailbox without deleting the user in Microsoft 365. First, you must remove the licenses in Microsoft 365 admin center. After that, you can permanently delete the mailbox with PowerShell. The user will remain active and can still sign in to other Microsoft services, like Microsoft Teams.

Did you enjoy this article? You may also like Export Microsoft 365 users licenses. Don’t forget to follow us and share this article.

o365info Team

o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has 0 Comments

Leave a Reply

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