STSADM Commands vs PowerShell 

We added solutions using the addsolution command to the Farm:

stsadm –o addsolution –filename “C:\ABC.wsp”

To deploy the solution we used the deploysolution command:

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

To upgrade a solution we used the upgradesolution command:

stsadm –o upgradesolution –name MySharePointSolutionPackage.wsp –filename “C:\ABC.wsp” –immediate

To retract and remove a solution we used the retractsolution and removesolution commands respectively:
stsadm –o retractsolution –name ABC.wsp –url http://webapplication –immediate
stsadm –o deletesolution –name ABC.wsp

Powershell Solution Cmdlets

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

 Add-SPSolution –LiteralPath “C:\ABC.wsp”

To adding a Sandboxed solution use the Add-SPUserSolution cmdlet:
 Add-SPUserSolution –LiteralPath “C:\ABC.wsp” –Site http://webapplication/sitecollection

Installing the Solution

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

 Install-SPSolution –Identity ABC.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

Updating the Solution
To update (know as upgrade in stsadm) a Farm solution use the Update-SPSolution cmdlet:
 Update-SPSolution –Identity MySharePointSolution.wsp –LiteralPath “C:\ABC.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 ABC.wsp

Removing the Solution 
To uninstall and remove FARM level solutions use the Uninstall-SPSolution and Remove-SPSolution cmdlets:
 Uninstall-SPSolution –Identity ABC.wsp –WebApplication http://webapplication
 Remove-SPSolution –Identity ABC.wsp

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

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

Advertisements