Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PowerShell jobs let you run commands concurrently while keeping the current session available. Choose a process job for local isolation, a thread job for lower-overhead local work, a parallel pipeline for batches of input, or a remote job for work on other computers. Starting a job returns a job object—not its results—so you must wait for and receive output separately.

Choose the right kind of PowerShell job

PowerShell documents three broad job types: remote jobs, background jobs running in a separate local process, and thread jobs running in a separate thread of the current local process. These options differ in location, isolation, serialization, and shared-state risks—not just speed. See Microsoft’s about_Jobs and about_Thread_Jobs.

Need Starting point Tradeoff
Run local work in a separate process for stronger isolation Start-Job { ... } Process startup and serialization add overhead; retrieve output separately.
Run local work in a thread Start-ThreadJob { ... } Generally lower overhead and live object references, but jobs share the parent process and require care with shared state.
Run an operation concurrently for pipeline input ForEach-Object -Parallel { ... } Set a suitable concurrency limit; parallel child output order is not guaranteed.
Run commands on remote computers Invoke-Command -ComputerName ... -AsJob Requires working remoting connectivity and configuration; remoting transfers and serializes data.

Process and remote jobs provide a process or machine boundary that can isolate failures more effectively than threads. Thread jobs avoid remoting serialization and can be lighter, but a critical failure in the shared PowerShell process can affect other work. Remote execution is appropriate when the target is another computer, not simply as a faster form of local execution. Microsoft’s about_Remote_Jobs explains remote job behavior.

Start a job, wait for it, and receive its output

This process-job example retains the returned job object, waits for completion, and stores the results:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
PowerShell for Sysadmins: Workflow Automation Made Easy
  • Book - powershell for sysadmins: workflow automation made easy
  • Language: english
  • Binding: paperback
$job = Start-Job -ScriptBlock { Get-Process }
$job | Wait-Job
$result = Receive-Job -Job $job

Start-Job returns promptly with a job object. Use Get-Job to list jobs known to the current session, Wait-Job to wait, and Receive-Job to collect output. A job can complete or fail; check its state and any errors rather than assuming the command succeeded. After collecting output and when you no longer need the job record, remove it with Remove-Job.

The same lifecycle can be written as a pipeline with a thread job:

Start-ThreadJob -ScriptBlock { Get-Process } |
    Wait-Job |
    Receive-Job

PowerShell 7’s ForEach-Object -Parallel runs script blocks concurrently for pipeline items. With -AsJob, it returns a task job that can be handled by the job cmdlets:

$job = 1..5 | ForEach-Object -Parallel { Write-Output $_ } -AsJob
$job | Wait-Job
$results = Receive-Job -Job $job

Parallel child jobs may finish in a different order from their input, so do not use output position as a reliable way to identify an input item. Include an identifier in each result when you need to associate outputs with inputs.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Pass data safely and limit concurrency

In a ForEach-Object -Parallel script block, $_ refers to the current pipeline item. Use $Using: to reference a value from the outer scope. Thread-job examples can also pass data using pipeline input or ArgumentList.

Threads share the process, so take particular care with mutable reference-type objects. Microsoft’s thread-job guidance warns against assigning to, or invoking methods or properties on, a non-thread-safe shared object while concurrent jobs are using it. If workers must mutate shared state, use a thread-safe collection whose behavior suits the task; Microsoft’s example uses ConcurrentDictionary.

Parallel work is not automatically faster. It can help when tasks are independent and spend substantial time computing or waiting, but setup costs and resource contention can outweigh the benefit. Use a concurrency limit when the command supports one; excess work waits rather than running all at once. Microsoft’s parallel execution performance guidance documents a default runspace pool size of five for ForEach-Object -Parallel beginning with PowerShell 7.1. This is a software default, not a recommended value for every workload. Start-Job has no ThrottleLimit parameter, so manage the number of process jobs yourself.

Understand job lifetime and cleanup

Ordinary jobs depend on the parent session: if that session terminates, its running child jobs are terminated too. They are therefore not a way to detach a long-running task from the session. For work that must outlive an interactive session, Microsoft’s job guidance points to disconnected remoting sessions or a separate process launched with Start-Process; these have different lifecycle behavior from ordinary jobs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When a job is no longer useful, Stop-Job requests that it stop. Once you have handled its output and no longer need its record, use Remove-Job. For a job that fails, inspect its state and error information before deciding whether to retry or change the command.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Commands at a glance

  • Start-Job: run a script block as a local process job.
  • Start-ThreadJob: run work in a thread of the current local process.
  • Invoke-Command -ComputerName ... -AsJob: run commands remotely as a job.
  • ForEach-Object -Parallel: process pipeline items concurrently; -AsJob returns a task job.
  • Get-Job, Wait-Job, and Receive-Job: inspect, wait for, and collect job output.
  • Stop-Job and Remove-Job: stop work and remove job records.

The linked Microsoft Learn pages are versioned for PowerShell 7.5; command behavior and documented defaults can change across releases. Check the documentation for the PowerShell version you actually use.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.