Thursday, April 14, 2011

Compare powershell and STSAdm commands for SharePoint


Here is the Most important STSAdm commands which is used in Sharepoint 2007 for scripting. I have converted those comands into PowerShell, so you can compare and use it. Here is the sample to compare side by side STSAdm and PowerShell commands for Sharepoint:

    STSAdm Command
  • stsadm –o addsolution –filename “D:\Temp\YourSharePointSolution.wsp“

  • stsadm –o deploysolution –name YourSharePointSolution.wsp –url http://myspwebappp –allowgacdeployment –immediate

  • stsadm –o upgradesolution –name YourSharePointSolution.wsp –filename “D:\Temp\YourSharePointSolution.wsp” -immediate

  • stsadm –o retractsolution –name YourSharePointSolution.wsp –url http://myspwebapp –immediate

  • stsadm –o deletesolution –name YourSharePointSolution.wsp

  • stsadm –o activatefeature –name YourFeatureName –url http://YourSharePointWebApp

  • stsadm –o deactivatefeature –name YourFeatureName –url http://YourSharePointWebApp

  • stsadm -o execadmsvcjobs

  • stsadm -o userrole -userlogin "YourUserOrGroupName" -role "Approve" -add -url "http:/YourSPSite"


    PowerShell Command
  • Add-SPSolution “D:\Temp\YourSharePointSolution.wsp“

  • Install-SPSolution –Identity YourSharePointSolution.wsp –WebApplication http://myspwebapp –GACDeployment

  • Update-SPSolution –Identity YourSharePointSolution.wsp –LiteralPath “D:\Temp\YourSharePointSolution.wsp” –GacDeployment

  • Uninstall-SPSolution –Identity YourSharePointSolution.wsp –WebApplication http://myspwebapp

  • Remove-SPSolution–Identity YourSharePointSolution.wsp

  • Enable-SPFeature –Identity YourFeatureNameOrGuid –url http://YourSharePointWebApp

  • Disable-SPFeature –Identity YourFeatureNameOrGuid –url http://YourSharePointWebApp

  • Start-SPAdminJob -Verbose

  • New-SPUser – UserAlias ‘YourUserOrGroupName’–displayname ‘Your Display Name’ –web YourSPSite


Here is the complete list of stsadm command and their related PowerShell command: Click HERE

No comments:

Post a Comment