通过PowerShell,Sitecore包安装失败

时间:2015-12-09 18:25:16

标签: powershell sitecore

我在通过Powershell在Sitecore中安装软件包时遇到错误。

packages in Sitecore through Powershell.

2 个答案:

答案 0 :(得分:0)

我们在社区https://community.sitecore.net/developers/f/7/t/1173

上报告了类似的问题

问题是我们构建的Web服务在安装向导的长时间运行过程中遇到超时。我们提供了一个解决方案,您可以在其中创建后台 ScriptSession 作业,以便稍后检索。

在我们的gitbook中,我们提供了此示例。

Import-Module -Name SPE
$session = New-ScriptSession -Username admin -Password b -ConnectionUri http://remotesitecore

$job = Invoke-RemoteScript -Session $session -ScriptBlock {
    Start-ScriptSession -ScriptBlock {
        # Replace the contents of this scriptblock with your installation steps. 
        # I just put $true there so something would come back.
        Start-Sleep -Seconds 10
        [PSCustomObject]@{"IsComplete"=$true}
    }
}

$keepRunning = $true
while($keepRunning) {
    $done = Invoke-RemoteScript -Session $session -ScriptBlock {
        $scriptSession = Get-ScriptSession -Id $params.JobId
        $scriptSession.State -ne "Busy"
    } -Arguments @{"JobId" = $job.ID} 

    if($done) {
        $keepRunning = $false

        Invoke-RemoteScript -Session $session -ScriptBlock {
            $scriptSession = Get-ScriptSession -Id $params.JobId
            if($scriptSession.State -ne "Busy") {
                $scriptSession | Receive-ScriptSession
            }
        } -Arguments @{"JobId" = $job.ID}    
    } else {
        Start-Sleep -Milliseconds 500
    }
}

期望看到本书的更新,以简化SPE 4的发布。

答案 1 :(得分:0)

这是示例代码

Import-Module -Name "C:\Scripts_31DEC\SPE Remoting-3.3\SPE"
$session = New-ScriptSession -Username admin -Password b -ConnectionUri http://quuintranet
$job = Invoke-RemoteScript -Session $session -ScriptBlock {
    Start-ScriptSession -ScriptBlock {
        # Replace the contents of this scriptblock with your installation steps. 
        # I just put $true there so something would come back.

        Install-Package -Path "C:\Scripts_31DEC\quutest_ow.zip" -InstallMode Overwrite
        [PSCustomObject]@{"IsComplete"=$true}
    }
}

$keepRunning = $true
while($keepRunning) {
    $done = Invoke-RemoteScript -Session $session -ScriptBlock {
        $scriptSession = Get-ScriptSession -Id $params.JobId
        $scriptSession.State -ne "Busy"
    } -Arguments @{"JobId" = $job.ID} 

    if($done) {
        $keepRunning = $false

        Invoke-RemoteScript -Session $session -ScriptBlock {
            $scriptSession = Get-ScriptSession -Id $params.JobId
            if($scriptSession.State -ne "Busy") {
                $scriptSession | Receive-ScriptSession
            }
        } -Arguments @{"JobId" = $job.ID}    
    } else {
        Start-Sleep -Milliseconds 500
    }
}