Restore a Deleted Site Collection

Scenario/Problem: You need to restore a previously deleted site collection on your SharePoint farm.

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

The Restore-SPDeletedSite cmdlet enables you to restore a deleted site collection from the current farm. Use this in conjunction with the Get-SPDeletedSite cmdlet (explained in a previous section), as shown in Listing 8.23, or just use the site collection identity directly in line, as shown in Listing 8.24.

Listing 8.23. Restoring a Deleted Site Collection Using a Variable

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

Listing 8.24. Restoring a Deleted Site Collection ...

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.