kwizcom banner advertisement

Deploy SharePoint Solution Packages (WSP) with PowerShell and STSADM

SharePoint solution packages (wsp) can be managed using either STSADM command line tool (in MOSS 2007) or with PowerShell cmdlets with SharePoint 2010 (such as deploy solution package with PowerShell). This article gives the reference for Managing SharePoint solutions using both of them with examples.

To add a solution package to the farm:
Add wsp with stsadm:
stsadm –o addsolution –filename mysolution.wsp

Add SharePoint solution using PowerShell:
Add-SPSolution "mysolution.wsp"

Add-SPSolution - MSDN Reference

Install/Deploy a Solution to the Farm:
STSADM command for wsp deployment:
stsadm –o deploysolution –name mysolution.wsp –url http://mysharepointsite –allowgacdeployment –immediate

SharePoint 2010 PowerShell to deploy/install wsp:
Install-spsolution -identity mysolution.wsp -webapplication http://mysharepointsite -gacdeployment -force
MSDN Reference

Upgrade an existing Solutions:
Update wsp solution with STSADM:
stsadm –o upgradesolution –name mySolution.wsp –filename "c:\MySolution.wsp" -immediate

PowerShell cmdlet to update solution in SharePoint 2010:
Update-SPSolution –Identity <solution file name>.wsp –LiteralPath C:\mysoln.wsp –GACDeployment
$solution = Get-SPSolution -Identity c0e31dec-294d-4f2d-9ae4-f2e637

Update-SPSolution $solution –LiteralPath "d:\newsolution.wsp" –Force -GACDeployment
MSDN Reference

Retract/un-install a Solutions from the Farm:
Retract solution with STSADM:
stsadm –o retractsolution –name mySolution.wsp –url http://mysharepointsite –immediate

Retract/uninstall SharePoint solution with PowerShell:
Uninstall-SPSolution –Identity <solution-file-name>.wsp –WebApplication http://mysharepointsite


$solution = Get-SPSolution -Identity c0e31dec-294d-4f2d-9ae4-f2e637
Uninstall-SPSolution $solution –WebApplication "SharePoint – 8080"

$solution = Get-SPSolution -Identity c0e31dec-294d-4f2d-9ae4-f2e637
Uninstall-SPSolution $solution –AllWebApplications

$solution = Get-SPSolution -Identity c0e31dec-294d-4f2d-9ae4-f2e637
Uninstall-SPSolution $solution
MSDN Reference

Remove/Delete a Solutions from the Farm:
Delete wsp solution with STSADM:
stsadm –o deletesolution –name mySolution.wsp  

Remove Farm solution in SharePoint 2010 with PowerShell:
Remove-SPSolution –Identity mySolution.wsp

If you don't know the Name, then Get the solution, and remove it:
$Solution = Get-SPSolution -Identity d0e11dec-293d-4c2d-9a24
Remove-SPSolution $solution
MSDN Reference

Get List of installed Solutions in the Farm:

Export/Save Solution Packages to WSP with PowerShell:
$solution = Get-SPSolution -Identity c0e31dec-294d-4f2d-9ae4
Deploy SharePoint Solution Packages (WSP) with PowerShell and STSADM Deploy SharePoint Solution Packages (WSP) with PowerShell and STSADM Reviewed by Salaudeen Rajack on 2:00 PM Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.