Some PS Script to install and uninstall Farm WSP

Following PowerShell Scripts are used often to install and deinstall SharePoint WSP Package (Farm Solution) without Visual Studio.

  • Add solution:

Add-SPSolution -LiteralPath “C:\temp\MySolution.wsp”

  • Install solution in GAC with the given WebApplication:

Install-SPSolution –Identity MySolution.wsp –WebApplication http://mywebapplication –GACDeployment

(If solution is only needed to be updated, the command “Update-SPSolution” should be executed, e.g.

Update-SPSolution –Identity Solution.wsp –LiteralPath “C:\temp\MySolution.wsp” –GacDeployment )

  • Uninstall and remove in the certain WebApplication:

Uninstall-SPSolution –Identity MySolution.wsp –WebApplication http://mywebapplication

Remove-SPSolution –Identity MySolution.wsp


Sometimes, Farm Feature should be enabled and disabled by PS.

Enable-SPFeature –Identity “MyFeatureName(or GUID)” –URL http://mywebapplication -Force

Disable-SPFeature –Identity “MyFeatureName(or GUID)” –URL http://mywebapplication

Parameters “-URL” and “-Force” are optional.

More details are included in TechNet site: