Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 2.0 » Receive-Job

Receive-Job - Powershell 2.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.

Receive-Job


Short description
Gets the results of the Windows PowerShell background jobs in the current session.

Syntax
Receive-Job [-Job] <Job[]> [[-ComputerName] <string[]>] [-Keep] [-NoRecurse] [<CommonParameters>]

Receive-Job [[-InstanceId] <Guid[]>] [-Keep] [-NoRecurse] [<CommonParameters>]

Receive-Job [-Job] <Job[]> [[-Location] <string[]>] [-Keep] [-NoRecurse] [<CommonParameters>]

Receive-Job [[-Name] <string[]>] [-Keep] [-NoRecurse] [<CommonParameters>]

Receive-Job [-Job] <Job[]> [[-Session] <PSSession[]>] [-Keep] [-NoRecurse] [<CommonParameters>]

Receive-Job [-Id] <Int32[]> [-Keep] [-NoRecurse] [<CommonParameters>]

Description
The Receive-Job cmdlet gets the results of Windows Powershell background jobs. Use Receive-Job to get the results o
f jobs started by using the Start-Job cmdlet or the AsJob parameter of any cmdlet. You can get the results of all j
obs or identify jobs by their name, ID, instance ID, computer name, location, or session, or by submitting a job ob
ject.

When you start a Windows PowerShell background job, the job starts, but the results do not appear immediately. Inst
ead, the command returns an object that represents the background job. The job object contains useful information a
bout the job, but it does not contain the results. This method allows you to continue working in the session while 
the job runs.  For more information about background jobs in Windows PowerShell, see about_Jobs.

To get the results of the command, use the Receive-Job cmdlet. Receive-Job gets the results that have been generate
d by the time that the Receive-Job command is submitted. If the results are not yet complete, you can run additiona
l Receive-Job commands to get the remaining results. 

By default, job results are deleted from the system when you receive them, but you can use the Keep parameter to sa
ve the results so that you can receive them again. To delete the job results, receive them again (without the Keep 
parameter), close the session, or use the Remove-Job cmdlet to delete the job from the session.