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:

https://technet.microsoft.com/en-us/library/ff607534.aspx

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s