Wednesday, January 16, 2013

Delete a SharePoint 2010 Site Collection

When you delete a site collection in SharePoint 2010 from the Web UI it is not immediately deleted. The site is inserted into a queue of "To be deleted" sites. A timer job (Name:Gradual Site Delete) then deletes the sites at some point. This is called "GRADUAL DELETION". This is recommended when you delete large sites to use less system load.

Sometimes this can cause errors when you want to create a site collection with the same url immediately after you deleted one. Then you have to wait until the site is really deleted by the timer job or use PowerShell to speed up the process.

Helpful PowerShell Commands

1.) You can list the sites in the deletion queue with PowerShell:


2.) To delete a site in the queue you can also use PowerShell:

 Remove-SPDeletedSite -Identity 1f11a7e8-4e89-48ref-af8a-ad805a505753 

(Identity is the SiteId)

3.) To restore a site collection in the queue use:

 Restore-SPDeletedSite -Identity 1f11a7e8-4e89-48ref-af8a-ad805a505753 

4.)If you want to delete a site collection right off without throwing it into the deletion queue use PowerShell with Gradualdelete = false option:

Remove-SPSite –Identity "http://sitename" –GradualDelete:$False


No comments: