SharePoint WSP Solutions and Features Deployment using STSADM, PowerShell

In this article I’m documenting the Deployment of WSP files using STSADM and with the PowerShell.

Before we begin, Its a good idea to add STSADM’s path (“C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\”) to the environment variable “Path”. It saves the typing 🙂
and of course, its a good idea to have a Batch file for these activities.

It includes following steps:

  • Step 1: Add Solution to SharePoint Farm
  • Step 2: Deploy Solution
  • Step 3: Activate Solution features

Add the solution:
stsadm -o addsolution -filename <Path to the WSP file> say for eg. “C:\Deployment\myWSP.wsp”

Deploy the solution:
stsadm -o deploysolution -name <Path to the WSP file> -immediate -allowgacdeployment  -url <URL>   say for e.g. “C:\Deployment\myWSP.wsp”

On installing/Activating/De-Activating/Uninstalling the Features, the following command shall be used:
stsadm -o installfeature -filename <FeatureFolder>\feature.xml

Activate the feature:
stsadm -o activatefeature -id <FEATUREID> -url <URL> -force

Deactive the feature:
Stsadm.exe -o deactivatefeature -filename “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\MyFeature\feature.xml” -url <URL>

Uninstall the feature:
stsadm -o uninstallfeature -filename “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\MyFeature\feature.xml”

Please note: if you are deploying a feature alone(without WSP) you need to deploy the feature in All the WFE’s.

Retract Solution:
stsadm -o retractsolution -name <Name of the solution>

Deploy a Solution through Central Admin:

Navigate to Central admin > Operations > solution Management

Select your WSP file to deploy, click on “Deploy solution”, click “OK” that’s All!

Here is the PowerShell way:
Fire the SharePoint 2010 Management Shell and type the following commands:

TO Add a New WSP:
Add-spsolution <Path to the WSP file> say for eg. “C:\Deployment\myWSP.wsp”

To deploy the WSP:
Install-spsolution -identity <Path to the WSP file> -gacdeployment

Deploy the WSP for a specify a URL:
Install-spsolution -identity <Path to the WSP file> -webapplication http://spsite -gacdeployment

Deploy a WSP In SharePoint 2010 Central Administration:

  • Navigate to : Central Administration > System Settings > Manage Farm Solution
  • Select your WSP file to deploy, click on “Deploy solution”, click “OK” that’s All!

Here is the Technet article for the complete reference:
http://technet.microsoft.com/en-us/library/cc263231%28office.12%29.aspx

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply