PowerShell添加和部署WSP


SharePoint PowerShell在SharePoint Product列表里邊,然后以管理員權限啟動。

1. 添加Solution 到 SharePoint Farm.

Add-SPSolution -LiteralPath "c:\ilt.wsp"

 

2.獲取已添加到SharePoint Farm的Solutions.

Get-SPSolution

 

3. 部署Solution 到SharePoint。

部署Solution到SharePoint Farm中:

Install-SPSolution -Identity ilt.wsp -GACDeployment

 possible errors:

Error Solution
Install-SPSolution : Admin SVC must be running in order to create deployment timer job. Open services.msc and start the service named SharePoint 2010 Administration.

Install-SPSolution : A deployment or retraction is already under way for the solution "webpartmanualdeployment.wsp", and only one deployment or retraction at a time is supported.

 

Go to Central Administration > System Settings > Manage farm solutions > Cancel / Retract the particular solution

部署Solution到指定的WebApplication中:

Install-SPSolution -Identity ilt.wsp -WebApplication http://sea:31996 -GACDeployment

 

插曲, 當部署到指定Web Application 遇到錯誤的時候, 要建一個Dummy data, 制定DeploymentTarget 為 WebApplication: 參考: http://sharedpointers.blogspot.in/2011/03/deploying-solutions-to-specific-web.html

即:

  1. Double click the package
  2. Open the Advanced
  3. add an additional assembly (the solution for example) and mark Deployment Type "Web Application"

4. 升級已部署的Solution

Update-SPSolution -Identity ilt.wsp -LiteralPath "C:\ilt.wsp" -GACDeployment

 

5.卸載已部署的Solution

Uninstall-SPSolution -Identity ilt.wsp

 

Web Application 級別的:

Uninstall-SPSolution -Identity ilt.wsp -WebApplication http://sea:31996

6.移除已卸載的Solution

Remove-SPSolution -identity ilt.wsp

 

Possilble Errors:

Remove-SPSolution: The solution cannot be removed when a job is scheduled or running.

這里介紹一種方法來撤銷這個部署的工作。

使用Stsadm -o enumdeployments 獲取JobId,:

 然后使用 stsadm -o canceldeployment -id JobId 來取消部署工作。

stsadm -o canceldeployment -id 2529c788-971c-46a3-b69f-a2a0a1fcc851

參考: http://blog.sina.com.cn/s/blog_5245a6580100z9bd.html

http://www.cnblogs.com/wsdj-ITtech/archive/2011/05/10/2041843.html

http://www.alexthissen.nl/blogs/main/archive/2007/07/18/removing-malfunctioning-windows-sharepoint-services-solutions.aspx

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM