Search This Blog

Wednesday, December 21, 2011

SharePoint Powershell for Solution Deployment (WSP)

SharePoint Powershell for Solution Deployment (WSP) [ 2 ] August 8, 2010 | Michal Pisarek 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: 1 stsadm –o addsolution –filename "C:\Deployment\MySharePointSolutionPackage.wsp" To deploy the solution we used the deploysolution command: 1 stsadm –o deploysolution –name MySharePointSolutionPackage.wsp –url http://webapplication –allowgacdeployment –immediate To upgrade a solution we used the upgradesolution command: 1 stsadm –o upgradesolution –name MySharePointSolutionPackage.wsp –filename "C:\Deployment\MySharePointSolutionPackage.wsp" –immediate To retract and remove a solution we used the retractsolution and removesolution commands respectively: 1 stsadm –o retractsolution –name MySharePointSolutionPackage.wsp –url http://webapplication –immediate 2 stsadm –o deletesolution –name MySharePointSolutionPackage.wsp Powershell Solution Cmdlets Adding To add a solution to the Farm solution store use the Add-SPSolution cmdlet: 1 Add-SPSolution –LiteralPath "C:\Deployment\MySharePointSolutionPackage.wsp" To add a Sandboxed solution use the Add-SPUserSolution cmdlet: 1 Add-SPUserSolution –LiteralPath "C:\Deployment\MySharePointSolutionPackage.wsp" –Site http://webapplication/sitecollection Installing To install ( commonly known as deploy) a Farm Solution we use the Install-SPSolution cmdlet: 1 Install-SPSolution –Identity MySharePointSolutionPackage.wsp –WebApplication http://webapplication –GACDeployment To install ( commonly known as deploy) a Sandboxed Solution we use the Install-SPUserSolution cmdlet: 1 Install-SPUserSolution –Identity MySharePointSolutionPackage.wsp –Site http://webapplication/sitecollection Updating To update (know as upgrade in stsadm) a Farm solution use the Update-SPSolution cmdlet: 1 Update-SPSolution –Identity MySharePointSolution.wsp –LiteralPath “C:\Deployment\MySharePointSolutionPackage.wsp” –GacDeployment To update (know as upgrade in stsadm) a Sandbox solution use the Update-SPUserSolution cmdlet: 1 Update-SPUserSolution –Identity MySharePointSolution.wsp –Site http://webapplication/site –ToSolution MySharePointSolutionPackage.wsp Removing To uninstall and remove FARM level solutions use the Uninstall-SPSolution and Remove-SPSolution cmdlets: 1 Uninstall-SPSolution –Identity MySharePointSolution.wsp –WebApplication http://webapplication 2 Remove-SPSolution –Identity MySharePointSolution.wsp To uninstall and remove Sandbox solutions use the Uninstall-SPSolution and Remove-SPSolution cmdlets: 1 Uninstall-SPUserSolution –Identity MySharePointSolution.wsp –Site http://webapplication/sitecollection 2 Remove-SPUserSolution –Identity MySharePointSolution.wsp –Site http://webapplication/sitecollection To get a list of all of the powershell cmdlets that deal with solutions use: 1 Get-Command –noun *SPSolution* To run all of the Administrative jobs that are queued: 1 Start-SPAdminJob So that’s it, next time let’s looks at some basic feature powershell cmdlets as well

No comments:

Post a Comment