In this post, we will learn how to install and deploy WSP SharePoint Solutions using PowerShell for SharePoint 2016, 2013, and SharePoint 2010.
-
1
What is the SharePoint Solution Package (WSP)?
- 1.1 What’re the required permissions to install and deploy WSP SharePoint Solutions?
- 1.2 How to install and deploy WSP SharePoint Solution Package?
- 1.3 How to deploy WSP SharePoint Solution using SharePoint Central Administration?
- 1.4 How to Backup all deployed SharePoint solutions (WSP) within the farm?
- 1.5 How to bulk deploy WSP SharePoint Solutions?
- 1.6 How to uninstall a WSP SharePoint Solution Package using PowerShell
The SharePoint solution package (WSP) is a distributed package that delivers your custom SharePoint Server development work to the Web servers or the application servers in your server farm.
The solution package is a CAB file with a .wsp file name extension and a manifest file.
You can use the farm account to deploy WSP SharePoint Solutions on your farm but this will require adding it to the Local Administrator Group at least during the deployment process! But actually, it’s not recommended and most organizations disallow the farm account to login to the server.
So Instead, you should use Setup Account to deploy a WSP SharePoint solution package, or another account that should have the below permissions:
- SharePoint Farm Administrator.
- A member of the Local Administrators Group on any computer on which you run Windows PowerShell.
- A db_owner database base role permission on the SharePoint Config, Admin, and Content databases.
To check what are the main differences between Farm Account and Farm Administrator, Please check SharePoint Service Account Best Practices 2019/2016
As we know, you can’t add WSP SharePoint solution through the SharePoint Central Administration, and you must use the PowerShell to Add a new WSP solution to the SharePoint Solution Management.
Also, the SharePoint deployment process consists of two main steps:
- Add WSP SharePoint solution.
- Install WSP SharePoint Solution.
To deploy a SharePoint WSP solution in SharePoint 2016 and SharePoint 2013, you have to do the following:
- Open SharePoint Management Shell as Administrator.
- Type the below Add-SPSolution cmdlet to add the WSP solution.
Add-SPSolution -LiteralPath "C:\Solution\Qassas.wsp"
- Then, type the below Install-SPSolution cmdlet to deploy the WSP SharePoint Solution for a specific web application on your farm.
Install-SPSolution –Identity Qassas.wsp –WebApplication http://Server/ -GACDeployment
Note:
GACDeployment
is the parameter that enables SharePoint to deploy the assemblies in the global assembly cache.
In SharePoint 2010,2007, you can use the below cmdlets to add and install a WSP SharePoint solution using stsadm
# Add WSP Solution in SharePoint using Powershell
stsadm.exe -o addsolution -filename "C:\Solution\Qassas.wsp"
# Install WSP Solution in SharePoint using Powershell
stsadm -o deploysolution -name Qassas.wsp -url http://Server/ -local -force
The STSADM is deprecated in SharePoint 2016.
As we earlier mentioned, You cannot upload a SharePoint solution to farm solution from Central Administration, you must first use Add-SPSolution
cmdlet to upload the WSP solution, then you can use PowerShell or Central Administration to deploy the uploaded solution!
To deploy WSP SharePoint Solution using SharePoint Central Administration, you should do the following:
- Open Central Administration > System Settings >Manage farm solutions.
- Click on the solution that needs to deploy.
- Click on deploy solution to install the solution
In Solution Management, there is no option to backup the deployed solution before deploying a new release, so that we have implemented a simple and smart PowerShell script that will help you to backup all deployed WSP solutions with versioning and log features to overcome this limitation in the SharePoint Solution Management.
We have also implemented a new PowerShell Script called “WSP SharePoint Deployer” that would help you to safely and easily install and deploy WSP SharePoint 2019 solutions on your farm with Backup, Rollback, Logging, and Versioning capabilities.
To uninstall a SharePoint solution from your SharePoint farm, you must first retract the solution then remove it.
Uninstall-SPSolution -Identity contoso_solution.wsp
After retracting the Sharepoint solution, you can now remove it via the below Cmdlet:
Remove-SPSolution -Identity contoso_solution.wsp
Applies To
- SharePoint 2016.
- SharePoint 2013.
- SharePoint 2010.