In SharePoint 2007, There was a wonderful tool from Codeplex: Site Delete Capture https://governance.codeplex.com/ to back up sites automatically when they gets deleted, So that we can restore a deleted site collection in SharePoint 2007.
In SharePoint 2010 SP1 and later, Microsoft added native support to capture/restore site collections or Sub-sites in the event of deletion.
So, when your sub-sites gets deleted, navigate to Site collection recycle bin and you can find the deleted sites, you will be able to restore from there.
What to do when the Site collection itself deleted?
How to restore deleted sites in SharePoint 2010? To recover deleted site collection in SharePoint 2010, You can use these three cmdlets:
- Get-SPDeletedSite – Displays list of sites deleted.
- Restore-SPDeletedSite – Restore a deleted site
- Remove-SPDeletedSite – To permanently remove the deleted site collection.
Permanently Remove the Deleted sites to Recover Disk Space:
After a while, many site collections were deleted in a clean-up activity. So decided to permanently delete all deleted site collections from recycle bin. Here is the PowerShell script:
Get-SPDeletedSite -webapplication https://sharepoint.company.com | Remove-SPDeletedSite