Background processing lets PowerShell run a command asynchronously while you continue using the shell. PowerShell calls these background commands jobs, which can be monitored and controlled separately from the interactive pipeline. section 14.1 section 14.2
Run a command synchronously while testing it so prompts, errors, and results are visible. Move it to the background only after it works reliably; background jobs cannot receive interactive input or prompt for missing parameters. section 14.2
Manage a job through a short monitoring-and-results workflow:
- Start work with Start-Job, Start-ThreadJob, or Invoke-Command using -AsJob. section 14.11 section 14.5
- Check status and metadata with Get-Job, optionally selecting a job by ID or name. section 14.7
- Retrieve cached output with Receive-Job; use -Keep to retain it for another retrieval or pipe it to tools such as Sort-Object and Export-CSV. section 14.7 section 14.12
- Stop unwanted work with Stop-Job, either from Get-Job or by specifying a job name. section 6.7 section 6.8
Search files without blocking the shell
Start-ThreadJob { gci / -recurse -filter '*.txt' } Get-Job Receive-Job -id 1 -Keep The first command searches for text files in a one-time thread job. Get-Job shows whether it has completed, and Receive-Job retrieves its results while preserving a copy. section 14.11 section 14.12
PS C:\> invoke-command -command { get-process }
-hostname (get-content .\allservers.txt )
-asjob -jobname MyRemoteJob
WARNING: column "Command" does not fit into the display and was removed.
Id Name State HasMoreData Location
-- ---- ----- ----------- --------
8 MyRemoteJob Running True server-r2,lo...
Inspect a named remote job created with Invoke-Command -AsJob, including its running state, location, and parallel target computers. section 14.5



