Background Jobs and Parallel Work

Start-ThreadJob runs a script block in the background while you keep working, Get-Job shows its State, and Receive-Job hands over what it printed; ForEach-Object -Parallel does each item in its own runspace, -ThrottleLimit 4 at a time, which resizes 500 photos in a quarter of the time, with $using: to bring in a variable from outside.

Updated

Cheat sheet for the lesson Background Jobs and Parallel Work: Start-ThreadJob runs a script block in the background while you keep working, Get-Job shows its State, and Receive-Job hands over what it printed; ForEach-Object -Parallel does each item in its own runspace, -ThrottleLimit 4 at a time…
Category
PowerShell
Level
Freelancer
Tags
background-job, foreach-object-parallel, operating-system, powershell, receive-job, runspace, start-threadjob