zoukankan      html  css  js  c++  java
  • 使用powershell部署WSP包

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

    卸载之后会重启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:SharepointDeployWSP" + $wspName 
    Add-SPSolution $webpartPath 
    Install-SPSolution -Identity $wspName -GACDeployment
    write-host "Solution" $wspName "Installation Completed!" -foregroundcolor green
    write-host "--------------------------" -foregroundcolor green
  • 相关阅读:
    while和do while习题
    Flexigrid折行显示问题
    【Cocos2d-x游戏引擎开发笔记(25)】XML解析
    ruby简单的基本 6
    原因好消息: PSP游戏自己主动算法设计(两)
    《约会专家》拖车【约会宝典】总结
    C++在stack的deque实现
    hdu 4869
    SQL Server 2008杀数据库连接
    BestCoder-Round#33
  • 原文地址:https://www.cnblogs.com/batter152/p/4900521.html
Copyright © 2011-2022 走看看