Display Available Site Collections in a Content Database

Scenario/Problem: You need to obtain a site collection reference and therefore need a listing of available site collection URLs.

Solution: Use the Get-SPSite cmdlet with the ContentDatabase parameter.

To obtain a site collection reference object, you need to find the URL (Identity) of the site collection. Using the Get-SPSite cmdlet with the ContentDatabase parameter, as shown in Listing 8.3, displays all available site collections in the specified content database.

Listing 8.3. Displaying Available Site Collections in a Content Database

Get-SPSite -ContentDatabase "WSS_CONTENT1"

Tip

Use the SP-GetContentDatabase cmdlet to display the available content databases used by the SharePoint ...

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.