PowerShell 发布farm solution
2017-01-04 13:19
459 查看
SharePoint PowerShell在SharePoint Product列表里边,然后以管理员权限启动。
1. 添加Solution 到 SharePoint Farm.
2.获取已添加到SharePoint Farm的Solutions.
3. 部署Solution 到SharePoint。
部署Solution到SharePoint Farm中:
如果部署的是 Sandboxed solution,则使用Install-SPUserSolution命令。
–GACDeployment 参数也可换成–CASPolicies,二者区别是
GACDeployment指定可以为新 SharePoint 解决方案部署全局程序集缓存 (GAC)。。
CASPolicies指定可以为新 SharePoint 解决方案部署代码访问安全 (CAS) 策略。
- WebApplication参数也可换成- AllWebApplications,二者区别是:
WebApplication: 为指定 SharePoint Web 应用程序部署 SharePoint 解决方案。该类型必须是格式为 12345678-90ab-cdef-1234-567890bcdefgh 的有效 GUID;
SharePoint Web 应用程序的有效名称(例如,MyOfficeApp1);或有效 SPWebApplication 对象的实例。
AllWebApplications: 指定为服务器场中的所有 SharePoint Web 应用程序部署新的 SharePoint 解决方案。
如果你需要强制部署此Solution,你可以使用-Force参数。
possible errors:
部署Solution到指定的WebApplication中:
我们也可使用–AllWebApplications参数来一次性从此Sharepoint Farm中的所有部署此Solution的Web Application中回收Solution.
执行此命令时,系统会提示: . “Are you sure?” ,你只需要确定即可执行操作。
插曲, 当部署到指定Web Application 遇到错误的时候, 要建一个Dummy data, 制定DeploymentTarget 为 WebApplication: 参考: http://sharedpointers.blogspot.in/2011/03/deploying-solutions-to-specific-web.html
即:
Double click the package
Open the Advanced
add an additional assembly (the solution for example) and mark Deployment Type "Web Application"
4. 升级已部署的Solution
5.卸载已部署的Solution
Web Application 级别的:
Uninstall-SPSolution -Identity ilt.wsp -WebApplication http://sea:31996
6.移除已卸载的Solution
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
eg:
//添加wsp包
Add-SPSolution C:\Users\akmii\Documents\Akmii.WuXiAppTec.Common.wsp
//deploy wsp 包
Install-SPSolution -Identity Akmii.WuXiAppTec.Common.wsp -GACDeployment –Force
//更新wsp包
Update-SPSolution -Identity Akmii.BMS.China.IHM.wsp -LiteralPath C:\WSP\Wsp-Xian\Akmii.BMS.China.IHM.wsp -GACDeployment -force
//强制删除
stsadm -o deletesolution -name akmii.museum.defines.wsp -override
//回收已经部署的Solution:
Uninstall-SPSolution –Identity MySharepointProject.wsp –WebApplication
//移除Solution
Remove-SPSolution –Identity MySharepointProject.wsp -Force
stsadm -o deploysolution -name Akmii.Museum.Web.wsp -immediate -allowGacDeployment -force
//备份还原站点集
Backup-SPSite http://server_name/sites/site_name -Path C:\Backup\site_name.bak (注意:c盘Backup路径必须存在 )
Restore-SPSite http://server_name/sites/site_name -Path C:\Backup\site_name.bak -Force (注意:站点集可以是新的站点也可以是原有的网站 )
1. 添加Solution 到 SharePoint Farm.
Add-SPSolution D:\Sp2010\DeploySolution\MySharepointProject.wsp (farm)
[b]Add-SPUserSolution -LiteralPath "c:\ilt.wsp" (sandbox)[/b]
2.获取已添加到SharePoint Farm的Solutions.
Get-SPSolution
3. 部署Solution 到SharePoint。
部署Solution到SharePoint Farm中:
Install-SPSolution –Identity MySharepointProject.wsp –WebApplication http://myserver-sp1:2010/ -GACDeployment
Install-SPSolution -Identity ilt.wsp -GACDeployment
如果部署的是 Sandboxed solution,则使用Install-SPUserSolution命令。
–GACDeployment 参数也可换成–CASPolicies,二者区别是
GACDeployment指定可以为新 SharePoint 解决方案部署全局程序集缓存 (GAC)。。
CASPolicies指定可以为新 SharePoint 解决方案部署代码访问安全 (CAS) 策略。
- WebApplication参数也可换成- AllWebApplications,二者区别是:
WebApplication: 为指定 SharePoint Web 应用程序部署 SharePoint 解决方案。该类型必须是格式为 12345678-90ab-cdef-1234-567890bcdefgh 的有效 GUID;
SharePoint Web 应用程序的有效名称(例如,MyOfficeApp1);或有效 SPWebApplication 对象的实例。
AllWebApplications: 指定为服务器场中的所有 SharePoint Web 应用程序部署新的 SharePoint 解决方案。
如果你需要强制部署此Solution,你可以使用-Force参数。
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 |
Install-SPSolution -Identity ilt.wsp -WebApplication http://sea:31996 -GACDeployment
我们也可使用–AllWebApplications参数来一次性从此Sharepoint Farm中的所有部署此Solution的Web Application中回收Solution.
执行此命令时,系统会提示: . “Are you sure?” ,你只需要确定即可执行操作。
插曲, 当部署到指定Web Application 遇到错误的时候, 要建一个Dummy data, 制定DeploymentTarget 为 WebApplication: 参考: http://sharedpointers.blogspot.in/2011/03/deploying-solutions-to-specific-web.html
即:
Double click the package
Open the Advanced
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
eg:
//添加wsp包
Add-SPSolution C:\Users\akmii\Documents\Akmii.WuXiAppTec.Common.wsp
//deploy wsp 包
Install-SPSolution -Identity Akmii.WuXiAppTec.Common.wsp -GACDeployment –Force
//更新wsp包
Update-SPSolution -Identity Akmii.BMS.China.IHM.wsp -LiteralPath C:\WSP\Wsp-Xian\Akmii.BMS.China.IHM.wsp -GACDeployment -force
//强制删除
stsadm -o deletesolution -name akmii.museum.defines.wsp -override
//回收已经部署的Solution:
Uninstall-SPSolution –Identity MySharepointProject.wsp –WebApplication
//移除Solution
Remove-SPSolution –Identity MySharepointProject.wsp -Force
stsadm -o deploysolution -name Akmii.Museum.Web.wsp -immediate -allowGacDeployment -force
//备份还原站点集
Backup-SPSite http://server_name/sites/site_name -Path C:\Backup\site_name.bak (注意:c盘Backup路径必须存在 )
Restore-SPSite http://server_name/sites/site_name -Path C:\Backup\site_name.bak -Force (注意:站点集可以是新的站点也可以是原有的网站 )
相关文章推荐
- PowerShell DSC组件 xExchange 发布
- 持续集成~Jenkins里的powershell插件发布远程站点了
- Powershell实践之Discuz!NT自动打包发布
- IBM发布用于管理WebSphere MQ的PowerShell命令(Cmdlet)
- 微软发布新一代命令行 PowerShell
- PowerShell~发布你的mvc网站
- 微软发布PowerShell Core第一个版本:支持多平台开发
- 发布支持多线程的PowerShell模块 —— MultiThreadTaskRunner
- Azure 基础:用 PowerShell 自动发布 CloudServices
- powershell 自动编译发布
- 微软刚刚发布开源跨平台PowerShell【赞!】
- Jenkins~powershell+cmd发布nuget包包
- 支持国内版Office 365的PowerShell模块现已发布
- Sharepoint 开启发布功能的PowerShell
- 微软 PowerShell Script Explorer 满血复活,正式发布
- DotNetCore跨平台~发布脚本PowerShell的设计
- 使用 PowerShell 自动化 CloudServices 发布
- Powershell实践之Discuz!NT自动打包发布
- 使用 PowerShell 自动化 CloudServices 发布
- WMF 3.0 RTM(包含PowerShell 3.0 )业已发布