Get a Specific Site Collection
Scenario/Problem: You need to obtain a specific site collection reference.
Solution: Use the Get-SPSite
cmdlet to assign a variable the results using the -Identity
parameter.
Providing the identity of the site collection with the Get-SPSite
cmdlet retrieves a specific site collection. Use this to assign the results to an object for use in other cmdlets, as shown in Listing 8.4.
$siteCol = Get-SPSite -Identity "http://sp2013"
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.