2,187
edits
m (Minor intro rewording, and Meta) |
m (→Overview: Minor rewording) |
||
Line 15: | Line 15: | ||
$job | Format-List * # Displays created $job object | $job | Format-List * # Displays created $job object | ||
</source> | |||
Wait-Job -job $job # Wait on completion of job | === Basic Commands === | ||
Receive-Job -job $job # Gets result of $job (ie | <source lang="powershell"> | ||
Wait-Job -job $job # Wait on completion of job - pause script processing until complete | |||
Receive-Job -job $job # Gets result of $job (ie what would have been presented to the console had the job run in an interactive PowerShell session) | |||
Get-Job # Shows list of jobs (current and completed) | Get-Job # Shows list of jobs (current and completed) | ||
Get-Job | Remove-Job # Clears list of jobs | |||
</source> | </source> | ||
Arguments have to be passed through to the job through the <code> -InputObject </code> parameter, which isn't particularly pretty. For further info see http://robertrobelo.wordpress.com/2010/03/14/background-jobs-input-gotcha/ for a | === Passing Arguments / Parameters to Jobs === | ||
Arguments have to be passed through to the job through the <code> -InputObject </code> parameter, which isn't particularly pretty (see below for how this works in practice). Background jobs run in a completely separate session, so objects/variables etc exists only in the scope of that job. | |||
For further info see http://robertrobelo.wordpress.com/2010/03/14/background-jobs-input-gotcha/ for a fuller explanation. | |||
=== Job Priority === | |||
Background jobs normally run with Below Normal priority (most processes, including PowerShell normally run as Normal priority). | |||
For more info on checking or changing see [[Getting_Started_(PowerShell)#Process_Priority|PowerShell Process Priority]]. | |||
=== Script Block or Script File ? === | === Script Block or Script File ? === |