Powershell工作流程超时控制故障>>

问题描述 投票:1回答:1

我有一个Powershell工作流程正在生成错误:

“操作未在指定的超时时间内完成00:00:30。分配给该操作的时间可能只是一部分超时的时间”

工作流程脚本为:

Workflow Test-Me (){
    Param
    (
        $Path = "c:\temp"
    )

    $Files = InlineScript{
                Get-ChildItem -Path $using:Path -File -Recurse -Force | Where-Object {$_.LastWriteTime -lt ((get-date).AddDays(-$using:Days))} | Select FullName
             }

    Foreach -parallel ($File in $Files){
        sequence{
            InlineScript{
                Remove-Item -Path $using:File.FullName -force -ErrorAction:SilentlyContinue
            } -PSActionRunningTimeoutSec 300
        }
    }
}

产生错误的行是处理InlineScript操作的remove-item。在达到上述操作后,它将运行并运行30秒钟,然后才能退出并返回上述错误。我已经将-PSActionRunningTimeoutSec参数添加到了InlineScript,但这并没有影响错误。我还设置了工作流通用参数,如下所示:

-PSRunningTimeoutSec = 300
-PSElapsedTimeoutSec = 0

我通过以下过程调用工作流cmdlet:

PS C:\> . "c:\path\to\Test-Me.ps1"
PS C:\> Test-Me -PSRunningTimeoutSec 300 -PSElapsedTimeoutSec 0

显然我找不到/不知道有超时的地方,但是powershell并不是特定的。我错过了什么超时?如何更改?

参考:

about_WorkflowCommonParameters

PowerShell Workflows: Using Parameters

Syntactic Differences Between Script Workflows and Scripts

about_InlineScript

<<

这可能无法完全回答您的问题,但可能会导致您找到解决方案。
您在MSDN Social上看到了这个问题吗?
powershell workflow-foundation powershell-3.0 workflow-activity
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.