zoukankan      html  css  js  c++  java
  • 用PowerShell批量部署wsp包

    转:http://www.xuebuyuan.com/168337.html

    提供wsp部署的参数:

    $wsppath:wsp文件所在的路径,如“c:”

    $wspnames:路径下的所有wsp文件名用逗号隔开,如“sumhtestwsp.wsp,sumhtestwsp123.wsp,sumhtestwsp456.wsp,sumhtestwsp789.wsp”

    $allwebapp:是否要全局部署,如“$True”,true是要全局部署$webId:$allwebapp为“$False”,那么就需要输入指定应用程序的Guid

     

    方法:

    function deployWSP([string] $wsppath,[string] $wspnames,[bool] $allwebapp,[Guid] $webId)

    {

        $PSSnapinSharePoin = Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction silentlycontinue

        if( $PSSnapinSharePoin -eq $Null)

        {

            Add-PSSnapin Microsoft.SharePoint.PowerShell;

        }

        foreach($wspname in $wspnames.split(','))

        {

            $gspsolution = Get-SPSolution -Identity $wspname -ErrorAction silentlycontinue

            if($gspsolution -eq $null)

            { 

                Add-SPSolution -LiteralPath $wsppath.Insert($wsppath.Length,$wspname)

            }

            if($allwebapp)

            {

                if(!$gspsolution.Deployed)

                {

                     Install-SPSolution -Identity $wspname -GACDeployment -AllWebApplications

                }

            }

            else

            {

                if(!$gspsolution.Deployed)

                {

                    Install-SPSolution -Identity $wspname -GACDeployment -WebApplication $webId

                }

            }

        }

    }    

    例如

    deployWSP -wsppath “c:” -wspnames “sumhtestwsp.wsp,sumhtestwsp123.wsp,sumhtestwsp456.wsp” -allwebapp $true

  • 相关阅读:
    安装图形化界面
    cemtos安装python
    traceback说明
    python常用魔法函数
    python上传文件接口
    文件上传接口
    MongoDB安装与使用
    解决macOS系统向有跳板机的服务器传文件
    mac终端命令sftp
    linux下mysql服务安装
  • 原文地址:https://www.cnblogs.com/jackljf/p/3588870.html
Copyright © 2011-2022 走看看