Unable to delete a shared mailbox in Exchange Online.

It’s been a short while since I posted anything, so here’s a small and simple issue I had today which I’ve dealt with in the past but forgot to write up here. Apparently it’s quite common; so, here’s a solution just in-case you stumble across this blog before the other 100+ other solutions available online.

The Problem

The Issue is the following error when trying to delete a mailbox from Office 365:

“The following error occurred during validation in agent ‘Windows LiveId Agent’: ‘Unable to perform the save operation. ” is not within a valid server write scope.”

The same error message is also presented when trying to run the “remove-mailbox” cmdlet in PowerShell.


Enable In-Place archiving on the mailbox. This can be seen by going to the mailbox in the Exchange Management Console as seen here:

Or you can run the following (Exchange Management) shell command to do this if you’re feeling shelly:

Enable-Mailbox -Identity <USERNAME> -Archive

Nice and easy. Wait a couple of sync cycles (or give it a push if you’re like me and can’t wait 30mins) and then you should be able to remove the mailbox.

Didn’t work?

In-Place archiving already enabled? No worries! Here’s another angle of attack:

Go to your EMS and select the offending mailbox. On the left-hand side of the window you should have the following option to convert the mailbox to a regular mailbox:

Click convert and let it do it’s business; it should take around 10 seconds.

Then once that’s completed you can use our good friend Mi-Shell to delete the offending item.

Firstly connect to the MSOL service using the following cmdlet:


This will pop up a Microsoft Online login box as shown below:

Enter your details and you should be back at the shell all signed in and ready to go.

Once back in we can run the following commands:

Remove-MsolUser -UserPrincipalName mailbox@yourcompany.co.uk


Remove-MsolUser -UserPrincipalName mailbox@yourcompany.co.uk -RemoveFromRecycleBin

This will not only remove the user but delete them from the Recycle bin too, hit refresh on your user list and the offending mailbox will/should disappear.

If you’re like me and you were trying to re-create a user properly on-prem in order to have them sync up into the cloud, you can run the following as you normally would (modified to your environment obviously):

New-Remotemailbox -Shared -Alias <alias> -Name <name> -FirstName <name> -LastName <name> -OnPremisesOrganizationalUnit "OU=<ou>,OU=<ou>,DC=COMPANY,DC=LOCAL" -SamAccountName <samaccountname> -UserPrincipalName <upn>@domain.co.uk

All done! I hope everyone reading this *cricket sounds* is staying safe and well in the crazy period we’re going through.

See you next time!


30-something Sysadmin from the Midlands, UK.