In this post we will discuss how to forcefully delete a corrupted site collection using PowerShell in SharePoint 2013. Recently we saw few of our site collections under a web application as giving 404 page not found error. There are the site collections which we have created using code.
The we saw in central administration page, in view all site collections page we can see the sites are listed there, but when we click on a particular site collection it did not populate the URL, Title, Description Database Name etc. Everything was blank. So basically we can not do anything with the site collections only we can see those in Site Collection List page. The we thought to delete the site collections.
– Create List Definition and List Instance in SharePoint 2013 using Visual Studio 2013
– Limitation of SharePoint Solutions and Advantages of SharePoint Add-ins
– Working with Current User Filter web part in SharePoint 2013 Online
Then we try to delete the site collection using PowerShell by using Remove-SPSite command we got the below error:
Then we follow below PowerShell to delete the corrupted site collection:
You can put the below PowerShell script in Windows PowerShell ISE and run the command.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$site = Get-SPSite $CorruptedSiteURL
$siteGUID = $site.Id
$siteDatabase = $site.ContentDatabase
$siteDatabase.ForceDeleteSite($siteGUID, $false, $false)
This time it deleted the site collection successfully.
Hope this will be helpful.