无法控制Powershell工作流超时
我有一个正在生成错误的powershell工作流: 操作未在分配的超时时间内完成 00:00:30. 分配给此操作的时间可能是一部分 更长的超时时间 工作流脚本是:无法控制Powershell工作流超时,powershell,workflow-foundation,powershell-3.0,workflow-activity,Powershell,Workflow Foundation,Powershell 3.0,Workflow Activity,我有一个正在生成错误的powershell工作流: 操作未在分配的超时时间内完成 00:00:30. 分配给此操作的时间可能是一部分 更长的超时时间 工作流脚本是: Workflow Test-Me (){ Param ( $Path = "c:\temp" ) $Files = InlineScript{ Get-ChildItem -Path $using:Path -File -Recurse -Force
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。它在到达操作后运行并工作30秒,然后退出,出现上述错误。我已将-PSActionRunningTimeoutSec参数添加到InlineScript中,但这不会影响错误。我还设置了工作流常用参数,如下所示:
-PSRunningTimeoutSec = 300
-PSElapsedTimeoutSec = 0
我通过以下过程调用workflow cmdlet:
PS C:\> . "c:\path\to\Test-Me.ps1"
PS C:\> Test-Me -PSRunningTimeoutSec 300 -PSElapsedTimeoutSec 0
很明显,某个地方有一个超时,我找不到/不知道,但powershell没有具体说明。我错过了什么超时时间?如何更改它
参考资料: