Delete corrupted SharePoint site collection using PowerShell

This SharePoint PowerShell tutorial, we will discuss how to forcefully delete a corrupted site collection using PowerShell in SharePoint 2013/2016.

Recently we saw a few of our SharePoint site collections under a SharePoint web application as giving 404 pages not found the error. There are the site collections that we have created using code.

We saw on the 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 the Site Collection List page. We thought to delete the site collections.

Then we try to delete the site collection using PowerShell by using Remove-SPSite command we got the below error:

<nativehr>0x80070003</nativehr><nativestack></nativestack>

Delete corrupted SharePoint site collection using PowerShell

Then we follow below PowerShell to delete the corrupted site collection:

You can put the PowerShell script in Windows PowerShell ISE and run the command.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$CorruptedSiteURL ="http://mynewwebapp:42885/sites/MyDeleteSiteCol"
$site = Get-SPSite $CorruptedSiteURL
$siteGUID = $site.Id
$siteDatabase = $site.ContentDatabase
$siteDatabase.ForceDeleteSite($siteGUID, $false, $false)

This time it deleted the SharePoint site collection successfully.

You may like following PowerShell SharePoint tutorials:

Here we learned how to delete corrupted site collection using PowerShell in SharePoint 2013/2016.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>