2,187
edits
m (→Gotchas: Rewording of "VMware PowerCLI 64 bit") |
m (→Overview: Minor rewording) |
||
Line 23: | Line 23: | ||
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 decent explanation, though I do kind of cover this below. | 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 decent explanation, though I do kind of cover this below. | ||
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]]. | |||
Your background task can either take the form of a script block, or a script file. Personally I prefer to keep everything in one script as it makes organisation easier, up to an extent. | |||
=== Script Block or Script File ? === | |||
Your background task can either take the form of a script block, or a script file. Personally I prefer to keep everything in one script as it makes organisation and maintenance easier, up to an extent. However, there is a limit to size of a script block, though I've no idea what it is (it may relate to maximum script line length that PowerShell can handle). | |||
A script I was trying to mangle into running as a background job was large (20 KB, nearly 1000 lines), and it wouldn't run. Unfortunately I was short on time and didn't have a convenient way to test where the breaking point was. But your jobs will fail if they're too big. | |||
== Job Control == | == Job Control == |