Get a Specific Database

Scenario/Problem: You need to obtain a specific database reference.

Solution: Use the Get-SPDatabase cmdlet using the -Identity parameter to assign a variable to the results.

Providing the identity of the database with the Get-SPDatabase cmdlet retrieves a specific database. Use this to assign the results to an object for use in other cmdlets, as shown in Listing 7.2.

Listing 7.2. Assigning a Variable to a Specific Database

$database = Get-SPDatabase-Identity 47036154-7a05-44be-9137-9be09f43ccb5

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.