【发布时间】:2021-11-11 22:00:15
【问题描述】:
我有以下命令,$a 有 20 个 URL:
$a = @('http://10.10.10.101/Login.aspx',
'http://10.10.10.101/user/customers')
$startFulltime = (Get-Date)
foreach($a1 in $a){
start-job -ArgumentList $a1 -ScriptBlock{
param($a1)
Invoke-WebRequest $a1 -Method post -DisableKeepAlive -UseBasicParsing
-ArgumentList $a1
}}
Get-Job | Wait-Job
克服错误:
Wait-Job : The Wait-Job cmdlet cannot finish working, because one or more jobs are blocked waiting for user interaction. Process interactive job
output by using the Receive-Job cmdlet, and then try again.
At line:13 char:11
+ Get-Job | Wait-Job
+ ~~~~~~~~
+ CategoryInfo : Deadlock detected: (System.Manageme...n.PSRemotingJob:PSRemotingJob) [Wait-Job], ArgumentException
+ FullyQualifiedErrorId : BlockedJobsDeadlockWithWaitJob,Microsoft.PowerShell.Commands.WaitJobCommand
参考链接:input objects in powershell jobs
请帮我解决错误,谢谢!
【问题讨论】:
-
首先在没有作业的情况下运行
Invoke-WebRequest,看看是哪一个导致了问题。
标签: powershell command-line-interface