PowerShell命令部署WSP

转载:http://www.cnblogs.com/ChunLiangZhang/archive/2012/07/18/2597335.html(作者:ChunLiang

现在可以用SharePoint PowerShell去部署自己的WSP。
SharePoint Management Shell (powershell with the Microsoft.SharePoint.Powershell snapin loaded) 
 
1.Add Solution Package
Add-SPSolution “C:\SharePoint2010Solution.wsp”
2.Install Solution Package
Install-SPSolution –Identity SharePoint2010Solution.wsp –WebApplication http://myserver –GACDeployment
3.Install Solution Package
Install-SPUserSolution –Identity SharePoint2010Solution.wsp     –WebApplication http://myserver  –GACDeployment
4.Update Solution Package
Update-SPSolution –Identity SharePoint2010Solution.wsp –LiteralPath “C:\SharePoint2010Solution.wsp” –GacDeployment
5.Uninstall Solution Package
Uninstall-SPSolution –Identity MySharePointSolution.wsp –WebApplication    http://myserver
6.Remove Solution Package
Remove-SPSolution–Identity MySharePointSolution.wsp
 
当然有时候PowerShell没有stsadm命令好用。当PowerShell部署有问题的时候,也可以试试stsadm命令。
1. stsadm –o addsolution –filename “D:\Deploy\MySharePointSolution.wsp“
2. stsadm –o deploysolution –name MySharePointSolution.wsp –url http://myspwebappp –allowgacdeployment –immediate
3. stsadm –o upgradesolution –name MySharePointSolution.wsp –filename “D:\Deploy\MySharePointSolution.wsp” -immediate
4. stsadm –o retractsolution –name MySharePointSolution.wsp –url http://myspwebapp –immediate
5. stsadm –o deletesolution –name MySharePointSolution.wsp
 
有一次部署WSP的时候,用PowerShell命令部署后说部署的不成功,但是这个WSP的feature又卸载不掉,下次部署又重复了。又要先解决feature问题。
stsadm –o activatefeature –name MyFeatureName –url http://myspwebapp
stsadm –o deactivatefeature –name MyFeatureName –url http://myspwebapp
或者
Enable-SPFeature –Identity MyFeatureNameOrGuid –url http://myspwebapp
Disable-SPFeature –Identity MyFeatureNameOrGuid –url http://myspwebapp
上一篇:Python字符串颜色输出


下一篇:利用 Grunt (几乎)无痛地做前端开发 (一)之单元测试