liveBook · Manning

Job

As explained in Practical Automation with PowerShell: Effective scripting from the console to the cloud

A job is an asynchronous PowerShell operation that runs work independently of the interactive command flow.

A job is an asynchronous PowerShell operation that runs work as a background process, allowing the interactive command flow to continue while the work proceeds. section 6.1.2

Use jobs when a command lacks a no-wait option or when several operations should run concurrently:

  • Start each operation with Start-Job and its own script block. section 6.1.2
  • Track completion with Get-Job and pause the workflow with Wait-Job. section 6.1.2
  • Retrieve command results with Receive-Job after the jobs finish. section 6.1.2

Parallel downloads

Start two Invoke-WebRequest commands as separate jobs, wait for both downloads to complete, and then continue the script. section 6.1.2

Start-Job -ScriptBlock {
    Invoke-WebRequest -Uri $UrlA -OutFile $FileA
}
Start-Job -ScriptBlock {
    Invoke-WebRequest -Uri $UrlB -OutFile $FileB
}
Get-Job | Wait-Job

Shows the compact job workflow for launching two downloads and waiting for completion. section 6.1.2

How Practical Automation with PowerShell: Effective scripting from the console to the cloud covers it

How deep it goes
Explains launching, waiting for, and receiving job results, but does not detail job-process internals.
Examples
Demonstrates downloading two files simultaneously with Invoke-WebRequest jobs.
What you can do after
Operate parallel PowerShell work, wait for completion, and collect results from jobs.
How it connects
Connects parallel execution with background processes and the Get-Job, Wait-Job, and Receive-Job cmdlets.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Practical Automation with PowerShell: Effective scripting from the console to the cloud. The section links point to the parts of the book it draws on.