Sometimes when a MySite Collection has been deleted, an automatic recreation can be triggered, preventing simple recovery. This article explains how to restore a site collection and if necessary, how to work around the later issue.
Restore a deleted Site Collection
Using PowerShell:
# List deleted sites
Get-SPDeletedSite
# Restore site using SiteId
Restore-SPDeletedSite -Identity <SiteId>
Code language: PHP (php)
Failure with error
If running the above restoration command returns the following error it means that the Site Collection has been automatically recreated.
Restore-SPDeletedSite : A site collection with the same Site Id or Path already exists.
At line:1 char:1
+ Restore-SPDeletedSite -Identity 8e453dbf-044c-4b4a-91d2-7e71abcf1c20
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Share...toreDeletedSite:
SPCmdletRestoreDeletedSite) [Restore-SPDeletedSite], SPException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreD
eletedSite
Code language: CSS (css)
Don’t overwrite the existing MySite, delete it and then restore following the steps below. Be sure to copy down the original Site Collection information, specifically the “SiteId” from the list of deleted sites.
The work around
This guide explains how to remove the existing MySite using Central Administration. And with this done, the desired MySite Collection can now be restored.
# Re-Run Restore using SiteId
Restore-SPDeletedSite -Identity <SiteId>
# Remove the unwanted MySite
Remove-SPDeletedSite -Identity <SiteId>
Code language: PHP (php)
Additional resources
SharePoint PowerShell commands reference.
On Office365 you can do the same with Powershell:-
To delete permanently the newly created (empty) site:-
Remove-SPOSite -Identity https://xxxxxx-my.sharepoint.com/personal/xxxxxxxxx
To restore the automatically deleted (full) site:-
Restore-SPODeletedSite -Identity https://xxxxxx-my.sharepoint.com/personal/xxxxxxxxx