Powershell Throttle Multi thread jobs via job completion

后端 未结 6 1497
情歌与酒
情歌与酒 2020-12-07 03:23

All the tuts I have found use a pre defined sleep time to throttle jobs. I need the throttle to wait until a job is completed before starting a new one. Only 4 jobs can be r

6条回答
  •  伪装坚强ぢ
    2020-12-07 04:21

    Your script looks good, try and add something like

    Write-Host ("current count:" + ($(Get-Job -State 'Running').Count) + " on server:" + $server)

    after your while loop to work out whether the job count is going down where you wouldn't expect it.

提交回复
热议问题