SharePoint - Another Way to Delete Site Collection
2019-06-05 13:19 努力学习的小熊 阅读(461) 评论(0) 编辑 收藏 举报
I had created a site collection. But there is a problem of web-frontend server (I did not know when I created the site), so the page is always in processing. After waiting 40 mins, I closed the page. When the problem of web-frontend server solved, I found the site link already existed, but I cannot connect to site and I cannot delete it in Central Administration. Try to delete site collection in Application Management, failed Use PowerShell to delete site collection, failed Nothing change |
The Central Administration displayed the site in the sites list, but without any reference to the Content Database where it should have been created. No way to remove it using the web interface (all pages displaying information about the site had no content at all).
Then i thought to clean it up and remove via script.
A simple Get-SPSite returned a valid object. But a subsequent Remove-SPSite failed with the dreaded “Unknown SPRequest error.occurred”.
I had to find a quick solution, like a “force delete” when the site cannot be deleted.
Therefore I used a not so well-known operation on the Content Database object: Microsoft.SharePoint.Administration.SPContentDatabase::ForceDeleteSite (see http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spcontentdatabase.forcedeletesite.aspx).
With this simple PowerShell code I managed to work it out and clean the unwanted or corrupted site.
$site = Get-SPSite http://siteurl $siteId = $site.Id $siteDatabase = $site.ContentDatabase $siteDatabase.ForceDeleteSite($siteId, $false, $false)
As the Information clearly states in the image As the Information clearly states in the image
Reference: https://sharepoint.stackexchange.com/questions/133131/cannot-delete-site-collection-in-central-administration