Get a Specific Web Application
Scenario/Problem: You need to obtain a specific web application reference.
Solution: Use the Get-SPWebApplication
cmdlet to assign a variable to the results using the -Identity
parameter.
Providing the identity of the web application with the Get-SPWebApplication
cmdlet retrieves a specific web application. Use this to assign the results to an object for use in other cmdlets, as shown in Listing 5.2.
$webApp = Get-SPWebApplication -Identity "PSWebApp"
Identity
, in this case, can be the display name shown when retrieving all web applications (Get-SPWebApplication
). You can also use the URL instead.
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.