Messing about with IT

Error deleting shared mailbox in Office 365 Exchange online

I recently got an error deleting a shared mailbox: The following error occurred during validation in agent ‘Windows LiveId Agent’: ‘Unable to perform the save operation. ‘shared-mailbox-user’ is not within a valid server write scope.’

This happened whether I attempted to delete the mailbox from the Microsoft 365 admin center, Exchange admin center or using Powershell.

Error deleting shared mailbox Windows LiveId Agent - Microsoft 365 admin center
Error deleting shared mailbox Windows LiveId Agent - Exchange admin center
PS C:\Users\windows-user> remove-mailbox -Identity shared-mailbox-user
The following error occurred during validation in agent 'Windows LiveId Agent': 'Unable to perform the save operation.
'shared-mailbox-user' is not within a valid server write scope.'
    + CategoryInfo          : NotSpecified: (:) [Remove-Mailbox], ProvisioningValidationException
    + FullyQualifiedErrorId : [Server=LO2P000MB0000,RequestId=0b0000c0-d0ca-00eb-000a-b0fef000ad0a,TimeStamp=27/03/202
   0 08:47:08] [FailureCategory=Cmdlet-ProvisioningValidationException] F5A49867,Microsoft.Exchange.Management.Recipi
  entTasks.RemoveMailbox
    + PSComputerName        : outlook.office365.com

I was short on time so raised a support case with Microsoft Premier Support to resolve this and they quickly came up with a solution to resolve the error deleting a shared mailbox .

The solution

  1. Convert the shared mailbox to a regular mailbox using the Exchange admin center
  1. Use the following PowerShell commands to delete the converted mailbox
PS C:\Users\windows-user> Remove-MsolUser -UserPrincipalName shared-mailbox-user@domain.co.uk

Confirm
Continue with this operation?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): y
PS C:\Users\windows-user> Remove-MsolUser -UserPrincipalName shared-mailbox-user@domain.co.uk -RemoveFromRecycleBin

Confirm
Continue with this operation?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): y

After that, the mailbox was gone.

Documentation links

If you want to read more about the PowerShell commands, see the Microsoft documentation links here:

https://docs.microsoft.com/en-us/microsoft-365/enterprise/connect-to-microsoft-365-powershell?view=o365-worldwide#connect-with-the-microsoft-azure-active-directory-module-for-windows-powershell

https://docs.microsoft.com/en-us/powershell/module/exchange/remove-mailbox?view=exchange-ps

https://docs.microsoft.com/en-us/microsoft-365/enterprise/delete-and-restore-user-accounts-with-microsoft-365-powershell?view=o365-worldwide#use-the-microsoft-azure-active-directory-module-for-windows-powershell

9 Comments

  1. Kaj

    Thank you! I couldn’t figure out how to get rid of the mailbox.
    We’re running a hybrid environment and the user wasn’t on the on-prem Exchange so I couldn’t get rid of it for some reason. But this method worked.

    • Dan

      That’s great, thanks for letting me know. Glad to hear it helped you!

  2. RESENDES 7451

    Thank you!!

  3. GR

    Thanks!!!
    I did not need to run powershell script to remove account.
    All i needed to do was to go to AD and delete.
    Thanks Again!

  4. Eileen

    Hi where does this PowerShell come from? Is it in Exchange Admin Center?

    • Dan

      Thanks for the question. The two Remove-MsolUser commands shown in the post were provided to me via a Microsoft support case as a way to solve the issue I had reported. I’ve just updated this post to include some links to the Microsoft documentation on these PowerShell commands if you want to read more.

  5. FedUpwithMS

    Funny that even their own support has to fall back on the MSOL commands which MS itself has deprecated and scheduled to stop working in 2023. (Unless they bump it again because they still haven’t fully replaced its functionality)

© 2024 Tech Explorer

Theme by Anders NorénUp ↑