Hello
Can someone please help me with the following question.
I understand PowerShell is executed from top to bottom and from left to right (like reading a book)
I also understand the pipeline is executed from left to right
that being the case, what I do not understand is the Wait-Job cmdlet
for example
Start-Job {some code....} | Wait-Job -timeout 100
take the above -timeout parameter above, how does it know the Start-Job started 101 seconds ago and therefore needs to timeout and move on after 101 seconds? as the data from the pipeline (e.g. the start-job object and its properties which I assume includes a start time) has not come down the pipeline yet, or has it?
I have not had much success using the above construct for example
foreach ($X in $Y) {
Start-Job {some code....} | Wait-Job -timeout 100
}
but several minutes later the console is still stationary and I have to press Ctrl+C so get it to continue to the next item in the foreach loop.
Is there a better way to control the execution of a tasks (that may become stuck for several reasons) and get the script to skip pass it to the next item. For example some underlaying .NET type or the new WorksFlow cmdlets
Thanks All
AAnotherUser