Start-Job bug with more than 5 calls

start-job -Name LongRunningQuery -scriptblock {Invoke-RestMethod /LongRunningQuery}
start-job -Name Deadlocking -scriptblock {Invoke-RestMethod /Deadlocking}
start-job -Name CPU -scriptblock {Invoke-RestMethod /CPU} 
start-job -Name Blocking -scriptblock {Invoke-RestMethod /Blocking} 
start-job -Name FailedJobs -scriptblock {Invoke-RestMethod/FailedJobs}
start-job -Name LogSpace -scriptblock {Invoke-RestMethod /LogSpace}

I have tested this multiple times, but when I run the above via a script it seems that the 6th job will not run from Powershell Universal despite showing as ‘running’. When I run the exact same command from my local instance, everything works as expected.

I may have jumped the gun here. Looks like my script is running longer than expected as I am watching it in a while loop with get-job.

Edit: It seems that if I include a while loop and watch the get-job output everything works great, but for some reason it won’t work when ran on a schedule and not using the while loop.

1 Like