Remove a Site Collection
Scenario/Problem: You need to remove a site collection from your SharePoint farm.
Solution: Use the Remove-SPSite
cmdlet with a site collection variable.
The Remove-SPSite
cmdlet enables you to remove a specific site collection from the current server. Use this in conjunction with the Get-SPSite
cmdlet (explained in a previous section), as shown in Listing 8.5, or just use the site collection identity directly in line, as shown in Listing 8.6.
$siteCol = Get-SPSite -Identity "http://sp2013/sites/sitecol"Remove-SPSite $siteCol
Remove-SPSite -Identity "http://sp2013/sites/sitecol"
The Remove-SPSite
cmdlet has ...
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.