ReceiveJobCommand ReceiveJobCommand ReceiveJobCommand Class

Definition

Cmdlet used for receiving results from job object. This cmdlet is intended to have a slightly different behavior in the following two cases:

  1. The job object to receive results from is a PSRemotingJob In this case, the cmdlet can use two additional parameters to filter results - ComputerName and Runspace The parameters help filter out results for a specified computer or runspace from the job object

    $job = Start-PSJob -Command 'get-process' -ComputerName server1, server2 Receive-PSJob -Job $job -ComputerName server1

    $job = Start-PSJob -Command 'get-process' -Session $r1, $r2 Receive-PSJob -Job $job -Session $r1

    1. The job object to receive results is a PSJob (or derivative other than PSRemotingJob) In this case, the user cannot will use the location parameter to do any filtering and will not have ComputerName and Runspace parameters

      $job = Get-WMIObject '....' -AsJob Receive-PSJob -Job $job -Location "Server2"

      The following will result in an error:

      $job = Get-WMIObject '....' -AsJob Receive-PSJob -Job $job -ComputerName "Server2" The parameter ComputerName cannot be used with jobs which are not PSRemotingJob

[System.Management.Automation.Cmdlet("Receive", "Job", DefaultParameterSetName="Location", HelpUri="https://go.microsoft.com/fwlink/?LinkID=113372", RemotingCapability=System.Management.Automation.RemotingCapability.SupportedByCommand)]
public class ReceiveJobCommand : Microsoft.PowerShell.Commands.JobCmdletBase, IDisposable
type ReceiveJobCommand = class
    inherit JobCmdletBase
    interface IDisposable
Public Class ReceiveJobCommand
Inherits JobCmdletBase
Implements IDisposable
Inheritance
Attributes
Implements

Constructors

ReceiveJobCommand() ReceiveJobCommand() ReceiveJobCommand()

Fields

ComputerInstanceIdParameterSet ComputerInstanceIdParameterSet ComputerInstanceIdParameterSet Inherited from PSRemotingCmdlet
ComputerNameParameterSet ComputerNameParameterSet ComputerNameParameterSet Inherited from PSRemotingCmdlet
ContainerIdParameterSet ContainerIdParameterSet ContainerIdParameterSet Inherited from PSRemotingCmdlet
DefaultPowerShellRemoteShellAppName DefaultPowerShellRemoteShellAppName DefaultPowerShellRemoteShellAppName Inherited from PSRemotingCmdlet
DefaultPowerShellRemoteShellName DefaultPowerShellRemoteShellName DefaultPowerShellRemoteShellName Inherited from PSRemotingCmdlet
LocationParameterSet LocationParameterSet LocationParameterSet
SSHHostHashParameterSet SSHHostHashParameterSet SSHHostHashParameterSet Inherited from PSRemotingCmdlet
SSHHostParameterSet SSHHostParameterSet SSHHostParameterSet Inherited from PSRemotingCmdlet
SessionParameterSet SessionParameterSet SessionParameterSet Inherited from PSRemotingCmdlet
VMIdParameterSet VMIdParameterSet VMIdParameterSet Inherited from PSRemotingCmdlet
VMNameParameterSet VMNameParameterSet VMNameParameterSet Inherited from PSRemotingCmdlet

Properties

AutoRemoveJob AutoRemoveJob AutoRemoveJob
Command Command Command
CommandOrigin CommandOrigin CommandOrigin Inherited from InternalCommand
CommandRuntime CommandRuntime CommandRuntime Inherited from Cmdlet
ComputerName ComputerName ComputerName

Name of the computer for which the results needs to be returned

CurrentPSTransaction CurrentPSTransaction CurrentPSTransaction Inherited from Cmdlet
Events Events Events Inherited from PSCmdlet
Filter Filter Filter
Force Force Force
Host Host Host Inherited from PSCmdlet
Id Id Id Inherited from JobCmdletBase
InstanceId InstanceId InstanceId Inherited from JobCmdletBase
InvokeCommand InvokeCommand InvokeCommand Inherited from PSCmdlet
InvokeProvider InvokeProvider InvokeProvider Inherited from PSCmdlet
Job Job Job

Job object from which specific results need to be extracted

JobManager JobManager JobManager Inherited from PSCmdlet
JobRepository JobRepository JobRepository Inherited from PSCmdlet
Keep Keep Keep

If the results need to be not removed from the store after being written. Default is results are removed.

Location Location Location

Locations for which the results needs to be returned. This will cater to all kinds of jobs and not only remoting jobs

MyInvocation MyInvocation MyInvocation Inherited from PSCmdlet
Name Name Name Inherited from JobCmdletBase
NoRecurse NoRecurse NoRecurse
PagingParameters PagingParameters PagingParameters Inherited from PSCmdlet
ParameterSetName ParameterSetName ParameterSetName Inherited from PSCmdlet
Session Session Session

Runspaces for which the results needs to be returned

SessionState SessionState SessionState Inherited from PSCmdlet
State State State
Stopping Stopping Stopping Inherited from Cmdlet
Wait Wait Wait
WriteEvents WriteEvents WriteEvents
WriteJobInResults WriteJobInResults WriteJobInResults

Methods

BeginProcessing() BeginProcessing() BeginProcessing()
CurrentProviderLocation(String) CurrentProviderLocation(String) CurrentProviderLocation(String) Inherited from PSCmdlet
Dispose() Dispose() Dispose()
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)
EndProcessing() EndProcessing() EndProcessing()

if we are not stopping, continue writing output as and when they are available

GetResolvedProviderPathFromPSPath(String, ProviderInfo) GetResolvedProviderPathFromPSPath(String, ProviderInfo) GetResolvedProviderPathFromPSPath(String, ProviderInfo) Inherited from PSCmdlet
GetResourceString(String, String) GetResourceString(String, String) GetResourceString(String, String) Inherited from Cmdlet
GetUnresolvedProviderPathFromPSPath(String) GetUnresolvedProviderPathFromPSPath(String) GetUnresolvedProviderPathFromPSPath(String) Inherited from PSCmdlet
GetVariableValue(String) GetVariableValue(String) GetVariableValue(String) Inherited from PSCmdlet
GetVariableValue(String, Object) GetVariableValue(String, Object) GetVariableValue(String, Object) Inherited from PSCmdlet
Invoke() Invoke() Invoke() Inherited from Cmdlet
Invoke<T>() Invoke<T>() Invoke<T>() Inherited from Cmdlet
ProcessRecord() ProcessRecord() ProcessRecord()

Retrieve the results for the specified computers or runspaces

ResolveAppName(String) ResolveAppName(String) ResolveAppName(String) Inherited from PSRemotingCmdlet
ResolveComputerName(String) ResolveComputerName(String) ResolveComputerName(String) Inherited from PSRemotingCmdlet
ResolveComputerNames(String[], String[]) ResolveComputerNames(String[], String[]) ResolveComputerNames(String[], String[]) Inherited from PSRemotingCmdlet
ResolveShell(String) ResolveShell(String) ResolveShell(String) Inherited from PSRemotingCmdlet
ShouldContinue(String, String) ShouldContinue(String, String) ShouldContinue(String, String) Inherited from Cmdlet
ShouldContinue(String, String, Boolean, Boolean) ShouldContinue(String, String, Boolean, Boolean) ShouldContinue(String, String, Boolean, Boolean) Inherited from Cmdlet
ShouldContinue(String, String, Boolean, Boolean, Boolean) ShouldContinue(String, String, Boolean, Boolean, Boolean) ShouldContinue(String, String, Boolean, Boolean, Boolean) Inherited from Cmdlet
ShouldProcess(String) ShouldProcess(String) ShouldProcess(String) Inherited from Cmdlet
ShouldProcess(String, String) ShouldProcess(String, String) ShouldProcess(String, String) Inherited from Cmdlet
ShouldProcess(String, String, String) ShouldProcess(String, String, String) ShouldProcess(String, String, String) Inherited from Cmdlet
ShouldProcess(String, String, String, ShouldProcessReason) ShouldProcess(String, String, String, ShouldProcessReason) ShouldProcess(String, String, String, ShouldProcessReason) Inherited from Cmdlet
StopProcessing() StopProcessing() StopProcessing()

StopProcessing - when the command is stopped, unregister all the event handlers from the jobs and decrement reference for results

ThrowTerminatingError(ErrorRecord) ThrowTerminatingError(ErrorRecord) ThrowTerminatingError(ErrorRecord) Inherited from Cmdlet
TransactionAvailable() TransactionAvailable() TransactionAvailable() Inherited from Cmdlet
WriteCommandDetail(String) WriteCommandDetail(String) WriteCommandDetail(String) Inherited from Cmdlet
WriteDebug(String) WriteDebug(String) WriteDebug(String) Inherited from Cmdlet
WriteError(ErrorRecord) WriteError(ErrorRecord) WriteError(ErrorRecord) Inherited from Cmdlet
WriteInformation(InformationRecord) WriteInformation(InformationRecord) WriteInformation(InformationRecord) Inherited from Cmdlet
WriteInformation(Object, String[]) WriteInformation(Object, String[]) WriteInformation(Object, String[]) Inherited from Cmdlet
WriteObject(Object) WriteObject(Object) WriteObject(Object) Inherited from Cmdlet
WriteObject(Object, Boolean) WriteObject(Object, Boolean) WriteObject(Object, Boolean) Inherited from Cmdlet
WriteProgress(ProgressRecord) WriteProgress(ProgressRecord) WriteProgress(ProgressRecord) Inherited from Cmdlet
WriteVerbose(String) WriteVerbose(String) WriteVerbose(String) Inherited from Cmdlet
WriteWarning(String) WriteWarning(String) WriteWarning(String) Inherited from Cmdlet

Applies to