February 2019
Intermediate to advanced
626 pages
15h 51m
English
The Start-Job command is most commonly used to execute a script block in a very similar manner to Invoke-Command. Start-Job may also be used to execute a script using the FilePath parameter.
When Start-Job is executed, a job object, System.Management.Automation.PSRemotingJob is created. The job object continues to be available using the Get-Job command regardless of whether the output from Start-Job is assigned. This is shown as follows:
PS> Start-Job -ScriptBlock { Start-Sleep -Seconds 10 }Id Name PSJobTypeName State HasMoreData Location Command-- ---- ------------- ----- ----------- -------- ------- 1 Job1 BackgroundJob Running True localhost Start-Sleep -Seconds 10PS> Get-JobId Name PSJobTypeName ...Read now
Unlock full access