首页 > 系统服务 > 详细

使用powershell部署WSP包

时间:2015-10-24 23:21:15      阅读:226      评论:0      收藏:0      [点我收藏+]

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

卸载之后会重启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包

原文:http://www.cnblogs.com/batter152/p/4900521.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!