Receive-Job
Use Receive-Job to collect the output of a job and, by default, remove it from the job's buffer.
Documentation: Microsoft Learn — PowerShell module reference
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Receive-Job [-Job] <Job[]> [-Keep] [-NoRecurse] [-Force] [-Wait] [-AutoRemoveJob] [-WriteEvents] [<CommonParameters>]- Stage 1Receive-Job
-Job -Keep -NoRecurse -Force -Wait -AutoRemoveJob -WriteEvents
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
Start-Job -Name svc
Show reference output
Sample output · fictional data, shaped like the real thing
Name Status ---- ------ BITS Running WinRM Stopped
Get-Job -Name svc
Show reference output
Sample output · fictional data, shaped like the real thing
Id Name State HasMoreData Location -- ---- --------- ----------- --------- 1 Job1 Completed True localhost 3 Job3 Running True localhost
Parameters
Parameter definitions:
-Job-Keep-NoRecurse-Force-Wait-AutoRemoveJob-WriteEvents
Practical use and troubleshooting
Practical scenario: Use Receive-Job when you need to collect the output of a job and, by default, remove it from the job's buffer. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: Output disappearing after an earlier receive can be expected because received results are removed by default. Use -Keep when repeated inspection is intentional and track which results were already handled. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Get-Job. Get-Job returns job metadata such as State; Receive-Job retrieves a job's output. Inspecting a Completed state is not the same as collecting its results. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Receive-Job Use Receive-Job to collect the output of a job and, by default, remove it from the job's buffer.
Next: Remove-Job