I'm a little confused about the difference between Start-Job
and Start-Process
in PowerShell. I know that Start-Job
will run in the background, but I'm wondering whether things run differently with Start-Job
than with Start-Process
and whether there are other implications of using one as opposed to the other . When should you use one over the other, and are there advantages that either has over the other?

- 12,097
- 13
- 56
- 69

- 23,275
- 22
- 95
- 156
1 Answers
Start-Job starts a background job and creates a job object that you use to monitor, query, and interact with the job using the cmdlets Get-Job, Receive-Job, Wait-Job, Stop-Job, and Remove-Job. You won't see any interactive windows or console output until you query the job object with Receive-Job. That's what "background job" means - that it runs, but doesn't interact with the logon session. However, if there's any output, that's collected by the job object, and you can retrieve it with Receive-Job. You can generally tell if there's data to receive by checking the HasMoreData property of the job object, but be careful, that's buggy in PowerShell 2 - remember this? "HasMoreData" is true even after Receive-Job
Start-Process launches a process that runs interactively.
-
7Important to note: **Jobs are local to your session.** You cannot do a `Start-Job` in one powershell session and `Receive-Job` in another. – Kellen Stuart Jul 26 '17 at 19:36