【问题标题】:Automatic deployment of solutions with PowerShell使用 PowerShell 自动部署解决方案
【发布时间】:2011-09-13 14:53:09
【问题描述】:

我有一个文件夹,其中包含我想要添加和安装的 SharePoint 应用程序的多个解决方案。我想遍历文件夹中的元素,然后使用 Add-SPSolution。之后,我想在使用 Install-SPSolution 之前检查解决方案是否已完成部署。这是我目前正在研究的一个 sn-p:

   # Get the location of the folder you are currently in
    $dir = $(gl)

    # Create a list with the .wsp solutions
    $list = Get-ChildItem $dir | where {$_.extension -eq ".wsp"}

    Write-Host 'DEPLOYING SOLUTIONS...'
    foreach($my_file in Get-ChildItem $list){Add-SPSolution -LiteralPath $my_file.FullName}

    Write-Host 'SLEEP FOR 30 SECONDS'
    Start-Sleep -s 30

    Write-Host 'INSTALLING SOLUTIONS...'
    foreach($my_file in Get-ChildItem $list){Install-SPSolution -Identity $my_file.Name -AllWebApplications -GACDeployment}

有没有办法检查部署是否完成,是否准备好开始安装解决方案?

【问题讨论】:

    标签: sharepoint powershell


    【解决方案1】:

    您需要在循环中检查SPSolution.Deployed property 值 - 基本解决方案如下所示:

    do { Start-Sleep 2 } while (!((Get-SPSolution $name).Deployed))
    

    Deploying SharePoint 2010 Solution Packages Using PowerShell 文章包含更多详细信息,this comment 讨论了一个潜在的警告。

    【讨论】:

      猜你喜欢
      • 2010-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-10
      • 1970-01-01
      相关资源
      最近更新 更多