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.
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
- Convert the shared mailbox to a regular mailbox using the Exchange admin center
- 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/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
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.
That’s great, thanks for letting me know. Glad to hear it helped you!
Thank you!!
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!
Hi where does this PowerShell come from? Is it in Exchange Admin Center?
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.
Hi, i guess question was, where to start the Powershell command from for > C:\ users\windows-user starting fom a client PC does not reach Echxange online. Thanks
OK, so if you follow steps 1 and 2 of the link above (and below in this comment) you can install the Microsoft Azure Active Directory Module, then connect to Exchange Online using that module before running the remove-mailbox and remove-MsolUser commands:
https://learn.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
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)