代码如下,先卸载,然后删除,然后添加,然后安装。

卸载之后会重启IIS,所以等待几秒钟,直到卸载完成。

添加snapin

$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null)
{
Write-Host "Loading SharePoint Powershell Snapin..."
Add-PSSnapin "Microsoft.SharePoint.Powershell"
Write-Host "SharePoint Powershell Snapin Loaded"
}

部署代码

################
#Deploy Timejob#
write-host ""
write-host "--------------------------" -foregroundcolor green
write-host "Starting Install Solution!" -foregroundcolor green
$webApplication = "http://xxxx/"
$wspName= "TimeJob.wsp"
$sln = get-spsolution -identity $wspName
Uninstall-SPSolution -Identity $wspName -confirm:$false
while($sln.JobExists) {
write-host "Uninstall in progress..." -foregroundcolor yellow
start-sleep -s 5
}
Remove-SPSolution -identity $wspName -confirm:$false
write-host "Solution Removed!" -foregroundcolor green
$webpartPath="C:\Sharepoint\Deploy\WSP\" + $wspName
Add-SPSolution $webpartPath
Install-SPSolution -Identity $wspName -GACDeployment
write-host "Solution" $wspName "Installation Completed!" -foregroundcolor green
write-host "--------------------------" -foregroundcolor green

使用powershell部署WSP包的更多相关文章

  1. SharePoint 2010 使用Install-SPSolution部署wsp包状态一直是”正在部署”

    1.服务器场信息如下: 2.使用下面命令部署,状态一直是"正在部署" Install-SPSolution –Identity xxxx.wsp –WebApplication h ...

  2. SharePoint 2010 部署 WSP 包

    转:http://www.cnblogs.com/myheaven/archive/2011/05/19/2051180.html .net在工程的下面生成了WSP包,在Debug下面.需要放到生产环 ...

  3. 使用命令部署wsp包,并将其部署到不同的web应用程序

    http://www.c-sharpcorner.com/uploadfile/anavijai/how-to-deploy-a-wsp-using-powershell-in-sharepoint- ...

  4. 用PowerShell批量部署wsp包

    转:http://www.xuebuyuan.com/168337.html 提供wsp部署的参数: $wsppath:wsp文件所在的路径,如"c:\" $wspnames:路径 ...

  5. 不直接登录SharePoint服务器,通过远程直接部署WSP解决方案包

    在这之前不得不说一下Sysinternals,他最初是一个网站,网站上会经常发布一些有用的系统扩展工具,之后运营这个网站的公司被微软收购.像非常著名的Procmon,AutoRuns.Process ...

  6. SharePoint 2010 WSP包部署过程中究竟发生什么?

    转:http://www.xue163.com/158/6/1585365.html 在SharePoint 2010中,我们可以使用Visual Studio 2010轻松创建WSP包来安装Web ...

  7. SharePoint 2010 PowerShell 系列 之 备份、还原、部署 .WSP

    转:http://www.cnblogs.com/Fengger/archive/2012/08/24/2654093.html PowerShell系列目录 最近在部署测试环境,就顺便把PowerS ...

  8. PowerShell命令部署WSP

    转载:http://www.cnblogs.com/ChunLiangZhang/archive/2012/07/18/2597335.html(作者:ChunLiang) 现在可以用SharePoi ...

  9. 部署解决方案包 (SharePoint Server 2010)

    转:http://technet.microsoft.com/zh-cn/library/cc262995(v=office.14).aspx 本文介绍各个解决方案包,及其在 Microsoft Sh ...

随机推荐

  1. Network - curl和Wget

    curl - transfer a URL curl SYNOPSIS curl [options] [URL...] DESCRIPTION curl is a tool to transfer d ...

  2. 关注经典:CSS Awards 获奖网站作品赏析《第一季》

    每天都有很多新的网站推出,其中不乏一些设计极其优秀的作品.这个系列的文章,我为大家挑选了2012年赢得 CSS Awards 大奖的50个最佳网站.这些鼓舞人心的网站作品代表了网页设计的最高水平,相信 ...

  3. NASA的下一个十年(译)

    原文 MICHAEL ROSTON (New York Times) 从左起:木卫二:土卫六:经过火星的水手谷星的合成图:金星的拼接图 大多数人已经从人类第一次近距离看到冥王星的兴奋中冷静下来.下一个 ...

  4. 实用js代码大全

    实用js代码大全 //过滤数字 <input type=text onkeypress="return event.keyCode>=48&&event.keyC ...

  5. 如何禁用事件的浮升(div的子元素的点击事件会触发父元素的点击事件)

    <div onclick="alert();"> <div onclick="alert();"></div> </d ...

  6. 转载:java程序员如何拿到2万月薪

    作者:匿名用户链接:https://www.zhihu.com/question/39890405/answer/83676977来源:知乎 著作权归作者所有.商业转载请联系作者获得授权,非商业转载请 ...

  7. QT学习笔记4

    顶层窗口-MainWindow 新建项目,选择基类的时Base Class是QMainWindow 最上面是Window Title,用于显示标题和控制按钮,比如最大化.最小化和关闭等:下面一些是Me ...

  8. 反射(Reflection)的SetValue遇上DBNULL转换为string

    有网友回馈说提供的代码有bug.你可以从这个链接下载得到:http://www.cnblogs.com/insus/p/3384472.html 其中有一个Utility,它是把DataTable转换 ...

  9. 开始ASP.NET MVC5之旅

    本教程将使用Visual Studio 2013手把手教你构建一个入门的ASP.NET MVC5 Web应用程序.本教程配套的C#源码工程可通过如下网址下载:C#版本源码链接.同时,请查阅 Build ...

  10. winform时钟c#代码

    代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data ...