Add a Solution to the SharePoint Farm

Scenario/Problem: You need to add a solution to the farm using a script.

Solution: Use the Add-SPSolution cmdlet.

Using the Add-SPSolution cmdlet adds a solution package (.wsp) to the farm. All you need to provide the cmdlet is the actual location of the solution package, as shown in Listing 9.1.

Listing 9.1. Adding a Solution to the SharePoint Farm

Add-SPSolution "c:\newsolution.wsp"

The solution location is the -LiteralPath parameter, which is required. The path can be a local drive location or network location using a UNC string (\\servername\folder).

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.