Thursday

STSADM Commands for Solutions and Features

Working with Solutions


stsadm –o addsolution –filename “D:\Deploy\MySharePointSolution.wsp
We used the following command to deploy the solution once installed to a specific web application:
stsadm –o deploysolution –name MySharePointSolution.wsp –url http://myspwebappp –allowgacdeployment –immediate
If we would upgrade an existing solution, we would use the following:
stsadm –o upgradesolution –name MySharePointSolution.wsp –filename “D:\Deploy\MySharePointSolution.wsp” -immediate
And finally, we used the following commands to retract and delete a specific solution from the web application:
stsadm –o retractsolution –name MySharePointSolution.wsp –url http://myspwebapp –immediate
stsadm –o deletesolution –name MySharePointSolution.wsp
Now, let us see how we could do above operations with PowerShell. For this, we use the following PowerShell commands:
Add-SPSolutionD:\Deploy\MySharePointSolution.wsp
Install-SPSolution –Identity MySharePointSolution.wsp –WebApplication http://myspwebapp –GACDeployment
If you would like to add the solution as sandboxed, you would use the Install-SPUserSolution command instead. To upgrade a solution, we specify which solution is to be updated and with which new solution file:
Update-SPSolution –Identity MySharePointSolution.wsp –LiteralPath “D:\Deploy\MySharePointSolution.wsp” –GacDeployment
To retract and remove a solution, we use the following commands:
Uninstall-SPSolution –Identity MySharePointSolution.wsp –WebApplication http://myspwebapp
Remove-SPSolution–Identity MySharePointSolution.wsp

Working with features

Similarly, commands exist for working with features. The stsadm equivalents:
stsadm –o activatefeature –name MyFeatureName –url http://myspwebapp
stsadm –o deactivatefeature –name MyFeatureName –url http://myspwebapp
Needless to say, there are easy equivalents in PowerShell:
Enable-SPFeature –Identity MyFeatureNameOrGuid –url http://myspwebapp
Disable-SPFeature –Identity MyFeatureNameOrGuid –url http://myspwebapp

A deployment or retraction is already under way for the solution

It occurs if anomalies deployment is running for the some package in the backend and some previous deployment has been crashed before due to reason.
To resolve this problem do the next steps:
1.       Run the command prompt
Click "Start", click "Run" type cmd
2.       Go to web server extensions folder
cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
3.       stsadm -o execadmsvcjobs
OR
Locate deployment jobId to break the running process
stsadm-o enumdeployments
Then cancel the deploy
stsadm-o canceldeployment-id "GUID jobId"