Sometimes, we might be deleting the Site Collections from the Central Admin or using the PowerShell scripts. Mostly, we might be deleting them with full conscious. But, if we want to restore the deleted site collection, there is no way (as far as my knowledge) from the Central Admin. But there is a way to restore using PowerShell.
The script is straight forward and can be used with a trick as well. Let me explain in detail.
Add-PSSnapin "Microsoft.SharePoint.Powershell"
$deletedSite = Get-SPDeletedSite "/sites/MyDeletedSite"
Restore-SPDeletedSite -Identity $deletedSite
The above script will work fine, when we have only one deleted site. In my case, I had a small problem. I had a site collection called “MyDeletedSite” as a TeamSite. I deleted that from the Central Admin. Later, I created another site with the same name as “MyDeletedSite” as a Publishing Portal. Then, again I deleted that also. Now, I wanted to restore “MyDeletedsite” which I created as a Team Site. Luckily, the method Get-SPDeletedSite method will give you all the deleted sites with the same name. From that, we need to identify which site we want to restore.
Add-PSSnapin "Microsoft.SharePoint.Powershell"
$deletedSite = Get-SPDeletedSite "/"
$tobeRestored = $deletedSite[1] # The site which we wanted to restore
Restore-SPDeletedSite -Identity $tobeRestored
Happy Coding,
Sathish Nadarajan.
Leave a comment