Install and deploy a SharePoint (WSP) Solution Package using SharePoint Shell

In this article, I’ll answer the following questions:

  • What is the SharePoint Solution Package (WSP)?
  • What’re the prerequisites to deploy a SharePoint Solution Package (WSP)?
  • How to deploy a Solution Package (WSP) in SharePoint 2010 and SharePoint 2013?
  • How to backup all the deployed SharePoint solutions (WSP) in the farm via PowerShell?
  • How to perform a bulk SharePoint Solution Package (WSP) deploy in SharePoint 2010 and SharePoint 2013?

What is a Solution Package?

A solution is a deployable, reusable package that can contain a set of Features, site definitions, and assemblies that apply to sites, and that you can enable or disable individually. You can use the solution file to deploy the contents of a Web Part package, including assemblies, class resources, .dwp files, and other package components. A solution file has a .wsp file extension. For more details check Deploy solution packages.

The prerequisites to deploy a Solution Package (WSP).

In order to deploy/remove a solution package using SharePoint Management Shell commands, you must first verify that you possess the following permissions:

  • SharePoint Farm Administrator.
  • You must be a member of the Administrators group on any computer on which you run Windows PowerShell.
  • db_owner permission on the content database.

Deploying a WSP solution package to SharePoint 2010 / 2013 via PowerShell

  • Add Solution Command via SharePoint 2010 Management Shell Cmdlet.

You cannot add a solution to the solution store by using the Solution Management page in Central Administration Meanwhile, you can only deploy.

stsadm.exe -o addsolution -filename "C:\Solution\CustomPasswordField.wsp"
  • Add Solution Command via SharePoint 2013 Management Shell Cmdlet.
Add-SPSolution -LiteralPath "C:\Solution\CustomPasswordField.wsp"
  • Deploy Solution Command via SharePoint 2010 Management Shell Cmdlet.
stsadm -o deploysolution -name CustomPasswordField.wsp  
-url  http://Server/ -local  -force
  • Deploy Solution Command via SharePoint 2013 Management Shell Cmdlet.
    • GACDeployment is the parameter that enables SharePoint to deploy the assemblies in the global assembly cache.
Install-SPSolution -Identity  -WebApplication  [-GACDeployment]

You can also deploy a WSP solution package to SharePoint 2010 / 2013 via Central Administration.

  • Open Central Administration > System Settings >Manage farm solutions.

Manage Farm Solution

  • Click on the solution that needs to deploy.

Farm Solution List

  • Click on deploy solution.

Deploy solution via CA

How to backup all the deployed SharePoint solutions (WSP) within the farm via PowerShell?

  • Create a ‘WSPSolutions’ folder at any location.
  • Open SharePoint Management Shell as Administrator.
  • Run the below cmdlets to backup all the deployed WSP solution in your farm
$FolderPath = "c:\WSPSolutions"  
foreach ($solution in Get-SPSolution)  
{  
   $id = $Solution.SolutionID  
   $title = $Solution.Name  
   $filename = $Solution.SolutionFile.Name  
   $solution.SolutionFile.SaveAs("$FolderPath\$filename") 

How to Perform a bulk Solution Package (WSP) deploy in SharePoint 2010 and SharePoint 2013?

I suggest using the SharePoint Solution Deployer to perform a bulk WSP SharePoint solutions deploy. For download https://spsd.codeplex.com/ 

Enjoy 🙂

See also How to Uninstall a SharePoint (WSP) Solution Package in SharePoint 2010 / 2013

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s