Sep 14
Check for multiple deleted site collections before restoring

​I got caught out recently with a customer request to restore an accidently deleted site collection.

I use the get-spdeletedsite to list all the sites that could be recovered (and there were a lot of them in this case)​. I scrolled up the output until I found the URL I was looking for and then copied the SiteID to use in the restore command.

Unfortunately​​ the customer complained that that this restored site didn't contain the content the expected. Turns out the had deleted and recreated the site several times so there were multiple copies of it in the recycle bin.

The following code makes it much easier to see all the deleted site collections and select one based on deleted date to restore.

$result = Get-SPDeletedSite | Select-object $properties | Sort-Object "Url" | Out-GridView -PassThru
if ($result){Restore-SPDeletedSite -Identity $result.SiteId;$result=$null}


There are no comments for this post.