Saturday 10 September 2016

SharePoint solution wsp Deployment SPSolution using PowerShell or STSADM - Uninstall, Remove, Add, Install

You are looking to have some handy commands or camdlets so this is/was/will very often commands that you may keep using as SharePoint Admin and developer SharePoint Environment so you can bookmark this blog.
is/was/will... why was? actually if you are working on SharePoint Online. for on premise you will need to have these information. ;)

So the deployment process includes below set of steps for existing Solutions in SharePoint.
  1. Retract solution
  2. Remove wsp
  3. Add wsp
  4. Deploy soltion. 
For new Solution deployment you will perform above mentioned two steps 3 and 4.
  
First Deactivate Solution then Remove Solution, then Add Solution from local drive and Activate to desired scope.


There are 3 simple ways to do so.
  1. From SharePoint site, go deactivate then from CA retract and remove solution.
  2. Second way is STSADM.exe
  3. Third and most preferred way is PowerShell.
Uninstalling wsp package using PowerShell command

Uninstall-SPSolution –Identity "MyWPSFile.wsp" –WebApplication "WebApp Url"

Remove wsp package using PowerShell command

Remove-SPSolution–Identity "MyWPSFile.wsp"

Add wsp package using PowerShell command

Add-SPSolution "C:\Praveen\MyWPSFile.wsp"

Installing SharePoint wsp package using PowerShell command

Install-SPSolution –Identity "MySolution.wsp" –WebApplication "url" –GACDeployment 

Installing SharePoint wsp at SharePoint 2013 version to deploy file at 15 hive and/or 14 hive, using PowerShell command


  • Uninstall-SPSolution SolutionName.wsp -AllWebApplications  #Solution deployed on AllWebApp
     
  • Remove-SPSolution SolutionName.wsp

    Add-SPSolution -LiteralPath "E:\Solutions\SolutionName.wsp"
     
  • Install-SPSolution -Identity SolutionName.wsp -GACDeployment -AllWebApplications -CompatibilityLevel "All" # You can mentioned 15 or 14 or both (All) to copy all files to 14 and 15 hive of your sharepoint 2013 version
     
  • Update-SPSolution also help you in same case.

Using STSADM command


open command prompt with Admin privileges and go to below path,
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\BIN
 

Add Solution
stsadm.exe -o addsolution -filename "c:\Praveen\MySolution.wsp"
 

Deploy Solution
stsadm.exe -o deploysolution -name "MySolution.wsp" -url "http://server/" -allowgacdeployment -immediate



Activate feature
stsadm.exe -o activatefeature -name "MySolution.wsp" -url "http://server/"


For bulk feature deployment or big releases we can plan sequence of wsp deployment and feature activation using PowerShell scripts and Configuration xml / csv or text files.


--
Thanks and let me know if needs any help


No comments:

Post a Comment