Wednesday, May 2, 2012

Powershell vs STSADM for Solution Deployment in Sharepoint 2010

Though Powershell is the new buzzword for Sharepoint Administrators(with Sharepoint 2010),we still can do most of these admin activities using the stsadm command line tool.Let us walk through how we used to do these activities in MOSS 2007 and how it is performed in Sharepoint 2010

STSADM Commands

1) To add solution to the Farm:

stsadm –o addsolution –filename "C:\Deployment\MySharePointSolutionPackage.wsp"

2) To deploy the solution

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

3) To upgrade a solution

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

4) To retract and remove a solution:

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

Powershell Solution Cmdlets

1) To add solution to the Farm:

Add-SPSolution –LiteralPath "C:\Deployment\MySharePointSolutionPackage.wsp"

To add a Sandboxed solution(adding to the site collection)

Add-SPUserSolution –LiteralPath "C:\Deployment\MySharePointSolutionPackage.wsp" –Site http://webapplication/sitecollection

2) To install ( deploy in stsadm) a Farm Solution:

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

To install ( deploy in stsadm)  a Sandboxed Solution (installing to the site collection):

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

3) To update (upgrade in stsadm) a Farm solution :

Update-SPSolution –Identity MySharePointSolution.wsp –LiteralPath “C:\Deployment\MySharePointSolutionPackage.wsp” –GacDeployment

To update (upgrade in stsadm) a Sandbox solution (updating to the site collection) :

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

4) To uninstall and remove FARM level solutions :

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

Remove-SPSolution –Identity MySharePointSolution.wsp

To uninstall and remove Sandbox solutions (uninstall and remove from the site collection):

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

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

Trivia :

To get a list of all of the powershell cmdlets :
Get-Command –noun *SPSolution*

To run all of the Administrative jobs that are queued:

No comments:

Post a Comment