5

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.

  1. Try to delete site collection in Application Management, failed

I select my site collection in Central Administration. For example, if I navigate to Application Management > View all site collections> selecte site collection, there is no information on the right side. No database, no adminitrator, nothing.

  1. Use PowerShell to delete site collection, failed

Remove-SPSite -Identity http://domain/sites/sitename"

Nothing change

I think I just created a link, no database connect to this site collection. How could I delete this site collection?

Thank you very much.

2
  • What error do you get in powershell? Are there any sitecollection object return if you run get-spsite on the central admin webapplication? Feb 25, 2015 at 14:16
  • Do you see it listed if you run (Get-SPWebApplication http:/ /webapp).sites?
    – Bunzab
    Feb 25, 2015 at 14:18

3 Answers 3

8

This was the same issue with me.

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

With this simple script i managed to clean the site collection wihcih i was unable to delete earlier.

Try it out . Njoy

4
  • thank you. But the link which you give me, does not work. The content is no longer available. Then, should I add site ID and Content Database to PowerShell code?
    – AnnaCICI
    Feb 25, 2015 at 15:00
  • yes you have to add the site id and database id to the code. and done Feb 25, 2015 at 17:05
  • but there is no information in central administration, I think database did not create for this site, how I get database id?
    – AnnaCICI
    Feb 26, 2015 at 14:32
  • you can use the database id with following code snippet from Benny to get the detailed information and then use the Database id instead of name Feb 26, 2015 at 14:45
4

Maybe you have deleted the site before, and it's lurking around in a dark place? Try this and see what you get...

Get-SPDeletedSite & Remove-SPDeletedSite

You may already have restored this site before. In that process you also deleted the site first (automatically), which you can find running the command...

>Get-SPDeletedSite

You'll see the site (or sites) listed, like this:

WebApplicationId   : 009c1289-392b-43a6-8222-146117074738
DatabaseId         : 88efc46f-5a2b-4171-81cb-7577da65bac3
SiteSubscriptionId : 00000000-0000-0000-0000-000000000000
SiteId             : 86d69f7e-3a9e-4f65-8eba-550d77f93a18
Path               : /sites/collaboration
Scheme             : Http
Url                : http://portal/sites/collaboration
DeletionTime       : 2014-02-21 11:14:18

WebApplicationId   : c73bb367-d329-4ef2-aef7-323ce207d2a9
DatabaseId         : aeb2d6ab-9f9b-493f-aefc-797d4b591f43
SiteSubscriptionId : 00000000-0000-0000-0000-000000000000
SiteId             : 9d0ed313-0353-4cec-817a-a491a8c5fc26
Path               : /
Scheme             : Http
Url                : http://portal/
DeletionTime       : 2014-02-19 15:27:37

Copy the SiteId and run

Remove-SPDeletedSite –Identity 9d0ed313-0353-4cec-817a-a491a8c5fc26
0

You can delete site collection using powershell by using following command

$tmpRoot = Get-SPWebApplication -Identity http://SP:2000
$tmpRootColl=$tmpRoot.Sites
#Enumerate through each site collection
for ($index=$tmpRootColl.Count-1 ; $index-ge 0 ; $index–-)
{
  Remove-SPSite -Identity $tmpRootColl.Item($index) -GradualDelete -Confirm:$false
}
Get-SPDeletedSite | Remove-SPDeletedSite

Where $tmpRoot is Web Application and $tmpRootColl is collection of sites under web application

Find full code with explanation from this blog CodePlayAndLearn

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.