Subscribe via RSS Feed Connect with me on LinkedIn

SharePoint Powershell for Solution Deployment (WSP)

[ 5 ] August 8, 2010 |

So we have covered a couple of areas with PowerShell but on of the most used, especially for those of use that like to play around with SharePoint, is the addition of solutions and features to our farms.

Now that we have PowerShell available in SharePoint 2010 you should really be using this to add your solutions, even though you can still do this with stsadm (but come on who wants to)

MOSS Solution Commands

In the 2007 days there were essentially 5 different commands used for dealing with solutions:

We added solutions using the addsolution command to the Farm:

stsadm –o addsolution –filename "C:DeploymentMySharePointSolutionPackage.wsp"

To deploy the solution we used the deploysolution command:

stsadm –o deploysolution –name MySharePointSolutionPackage.wsp –url http://webapplication –allowgacdeployment –immediate

To upgrade a solution we used the upgradesolution command:

stsadm –o upgradesolution –name MySharePointSolutionPackage.wsp –filename "C:DeploymentMySharePointSolutionPackage.wsp" –immediate

To retract and remove a solution we used the retractsolution and removesolution commands respectively:

stsadm –o retractsolution –name MySharePointSolutionPackage.wsp –url http://webapplication –immediate
stsadm –o deletesolution –name MySharePointSolutionPackage.wsp

Powershell Solution Cmdlets


To add a solution to the Farm solution store use the Add-SPSolution cmdlet:

Add-SPSolution –LiteralPath "C:DeploymentMySharePointSolutionPackage.wsp"

To add a Sandboxed solution  use the Add-SPUserSolution cmdlet:

Add-SPUserSolution –LiteralPath "C:DeploymentMySharePointSolutionPackage.wsp" –Site http://webapplication/sitecollection


To install ( commonly known as deploy)  a Farm Solution we use the Install-SPSolution cmdlet:

Install-SPSolution –Identity MySharePointSolutionPackage.wsp –WebApplication http://webapplication –GACDeployment

To install ( commonly known as deploy)  a Sandboxed Solution we use the Install-SPUserSolution cmdlet:

Install-SPUserSolution –Identity MySharePointSolutionPackage.wsp –Site http://webapplication/sitecollection


To update (know as upgrade in stsadm) a Farm solution use the Update-SPSolution cmdlet:

Update-SPSolution –Identity MySharePointSolution.wsp –LiteralPath “C:DeploymentMySharePointSolutionPackage.wsp” –GacDeployment

To update (know as upgrade in stsadm) a Sandbox solution use the Update-SPUserSolution cmdlet:

Update-SPUserSolution –Identity MySharePointSolution.wsp –Site http://webapplication/site –ToSolution MySharePointSolutionPackage.wsp


To uninstall and remove FARM level solutions use the Uninstall-SPSolution and Remove-SPSolution cmdlets:

Uninstall-SPSolution –Identity MySharePointSolution.wsp –WebApplication http://webapplication
Remove-SPSolution –Identity MySharePointSolution.wsp

To uninstall and remove Sandbox solutions use the Uninstall-SPSolution and Remove-SPSolution cmdlets:

Uninstall-SPUserSolution –Identity MySharePointSolution.wsp –Site http://webapplication/sitecollection
Remove-SPUserSolution –Identity MySharePointSolution.wsp –Site http://webapplication/sitecollection

To get a list of all of the powershell cmdlets that deal with solutions use:

Get-Command –noun *SPSolution*

To run all of the Administrative jobs that are queued:


So that’s it, next time let’s looks at some basic feature powershell cmdlets as well

Tags: ,

Category: General, How To

About Michal Pisarek: Michal Pisarek is the founder of Dynamic Owl Consulting and a Microsoft SharePoint MVP. View author profile.

Comments (5)

Trackback URL | Comments RSS Feed

  1. Dock says:

    I don’t really understand the reason for the powershell deployment when SP2010 now has you deploy via the GUI. In fact, when attempting to deploy some of the MS Fabulous 40, we kept getting errors in powershell.

  2. […] específicos para el trabajo con soluciones. Estos cmdlets como podéis ver en detalle en este enlace […]

  3. Parmeshwar Jadhao says:

    find best Powershell script to Add and install all wsp.

Leave a Reply

If you want a picture to show with your comment, go get a Gravatar.