Remove a Deleted Site Collection

Scenario/Problem: You need to remove a deleted site collection from your SharePoint farm.

Solution: Use the Remove-SPDeletedSite cmdlet with a site collection variable.

The Remove-SPDeletedSite cmdlet enables you to remove a specific site collection from the current server. Use this in conjunction with the Get-SPDeletedSite cmdlet (explained in a previous section), as shown in Listing 8.21, or just use the site collection identity directly in line, as shown in Listing 8.22.

Listing 8.21. Removing a Site Collection Using a Variable

$deletedSiteCol = Get-SPDeletedSite -Identity "/ sites/ deletedsitecol "Remove-SPDeletedSite $deletedSiteCol

Listing 8.22. Removing a Deleted Site Collection Directly

Remove-SPDeletedSite ...

Get PowerShell™ for SharePoint® 2013 How-To now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.