SharePoint PowerShell在SharePoint Product列表里边,然后以管理员权限启动。

1. 添加Solution 到 SharePoint Farm.

Add-SPSolution  D:\Sp2010\DeploySolution\MySharepointProject.wsp  (farm)
Add-SPUserSolution -LiteralPath "c:\ilt.wsp" (sandbox)

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

部署Solution到指定的WebApplication中:

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

即:

  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      
 
 
 
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 发布farm solution的更多相关文章

  1. [Powershell]发布基于.NET Framework的WebAPI和Job控制台程序项目

    获取要发布的定时计划任务. 禁用和停止定时计划任务. 批量强制结束Job进程. 打印定时计划任务状态. 备份项目文件夹. 发布项目文件夹. 删除部署包. 启用定时计划任务. <# .NOTES ...

  2. Export Farm Solution wsp Files SharePoint 2007 and 2010

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")$farm = [Microsof ...

  3. PowerShell~发布你的mvc网站

    通过使用ps加上msbuild可以方便的编译你的.net应用程序,并且可以把它发布到你的磁盘上,部署非常方例! 我们在c盘添加一个hello网站,解决方案名是hello.sln,它的网站是hello. ...

  4. PowerShell实现基于SharePoint的网站HomePage Auto-Configure Solution

    Home Page Web Parts Auto-Configuration PS:该项目为公司项目,我还是给他的名字屏蔽掉吧,这是我用PowerShell写的一个自动化升级工具,此为三部自动化工具的 ...

  5. powershell 操作sharepoint命令集

    打开SharePoint 2013 Management Shell, and then run as administrator.执行如下命令 1. 添加wsp和安装Add-SPSolution - ...

  6. SharePoint 2013 Sandbox Solution

    昨天在写SharePoint EventReceiver的时候遇到一个问题,创建了一个local farm SharePoint solution,添加了一个ItemAdded(SPItemEvent ...

  7. SharePoint Add-in Model 介绍 - 引文(先导篇)

    1. SharePoint 平台 如果你已经很熟悉 SharePoint 平台,可跳过本章节. 1.1 SharePoint 是什么 在介绍 Add-in Model 之前,简要提一下 SharePo ...

  8. SharePoint 新特性及安装需知

    以下内容转自Kaneboy 大牛,但我在安装正式版的过程中发现一些问题,主要是.net 版本的问题,弄了我一个晚上,我在下面标出来了.我的安装环境是Windows server 2012 R2 关于详 ...

  9. Sharepoint学习笔记—习题系列--70-573习题解析 -(Q115-Q117)

    Question 115You create a timer job.You need to debug the timer job.To which process should you attac ...

随机推荐

  1. POJ - 3984 bfs [kuangbin带你飞]专题一

    bfs搜索过程中将路径保存下即可. AC代码 #include<cstdio> #include<cstring> #include<algorithm> #inc ...

  2. yum源配置的三种方法

    (一)yum源概述 yum需要一个yum库,也就是yum源.默认情况下,CentOS就有一个yum源.在/etc/yum.repos.d/目录下有一些默认的配置文件(可以将这些文件移到/opt下,或者 ...

  3. Linux shell的问题

    1.uptime命令可以查看当前系统的启动时间: w命令显示当前登录者top命令显示当前任务ps命令显示所有进程信息 uptime命令可以查看系统启动时间   2.使用shell时,默认的环境变量放在 ...

  4. Mysql group by,order by,dinstict优化

    1.order by优化 2.group by优化 3.Dinstinct 优化 1.order by优化 实现方式: 1. 根据索引字段排序,利用索引取出的数据已经是排好序的,直接返回给客户端: 2 ...

  5. 借鉴mini2440的usb-wifi工具集在Beagleboard上移植无线网卡

    配置minicom: sudo yum install minicom sudo minicom -s 选择Serial port setup,此时所示光标在"Change which se ...

  6. gitlab启用https

    为了防止内网渗透,将gitlab服务的访问添加了ssl,具体步骤如下: 修改配置文件 [xieshuang@VM_177_101_centos gitlab]$ sudo vim /etc/gitla ...

  7. Redis Cluster的搭建与部署,实现redis的分布式方案

    前言 上篇Redis Sentinel安装与部署,实现redis的高可用实现了redis的高可用,针对的主要是master宕机的情况,我们发现所有节点的数据都是一样的,那么一旦数据量过大,redi也会 ...

  8. Linux如何查找处理文件名后包含空格的文件

    Linux如何查找处理文件名后包含空格的文件   当Linux下文件名中出现空格这类特殊情况话,如何查找或确认那些文件名后有空格呢? 又怎么批量替换处理掉这些空格呢? 方法1: 输入文件名后使用Tab ...

  9. angularjs1.6.4中使用ng-table出现data.slice is not a function的问题

    这个问题困扰了我2个小时. 项目中angularjs的版本从1.4.8升级到1.6.4,升级完成之后,发现ng-table不能用了.主要报错信息是ng-table中data.slice is not ...

  10. qwe 简易深度框架

    qwe github地址 简介 简单的深度框架,参考Ng的深度学习课程作业,使用了keras的API设计. 方便了解网络具体实现,避免深陷于成熟框架的细节和一些晦涩的优化代码. 网络层实现了Dense ...