Get a Specific Service Instance

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

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

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

Listing 6.8. Assigning a Variable to a Specific Service Instance

$serviceInst = Get-SPServiceInstance -Identity 5fedc699-7810-4157-9c59-19f7d6e67e38

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.