title: How can I tell what processes are started by a Start-Job command?
body: <p>I have (inherited) a PowerShell script that calls other PowerShell scripts by invoking them with a <code>Start-Job</code> cmdlet and the <code>-FilePath</code> parameter. For example, I have a script that does nothing:</p>
  
  <pre><code>Start-Sleep -Seconds 86400
  </code></pre>
  
  <p>Which I can invoke via a job:</p>
  
  <pre><code>PS&gt; Start-Job -Name "Test Job" -FilePath ".\Wait-AllDay.ps1"
  
  Id Name     PSJobTypeName State   HasMoreData Location  Command                        
  -- ----     ------------- -----   ----------- --------  -------                        
  2  Test Job BackgroundJob Running True        localhost Start-Sleep...
  
  PS&gt; Get-Job -Id 2
  
  State         : Running
  HasMoreData   : True
  StatusMessage : 
  Location      : localhost
  Command       : Start-Sleep -Seconds (60*60*24)
  JobStateInfo  : Running
  Finished      : System.Threading.ManualResetEvent
  InstanceId    : 0c0e2c32-cbc5-4d70-b7cb-28771626cf20
  Id            : 2
  Name          : Test Job
  ChildJobs     : {Job3}
  PSBeginTime   : 25/01/2016 15:06:22
  PSEndTime     : 
  PSJobTypeName : BackgroundJob
  </code></pre>
  
  <p>Is there any easy &amp; reliable way to find out what process is associated with this job (which I believe will be an additional <strong>powershell.exe</strong>)? Obviously this is easy in testing with just one job, but on a server I may have many of these running concurrently.</p>
  
  <h2>Why do I want to do/know this?</h2>
  
  <p>I'm in a new role, working on a server which has multiple scheduled tasks running a variety of scripts. Some of these call other scripts which my predecessor chose to invoke using Start-Job, possibly because they can be long running (multiple hours) and wanted them to work in parallel. Occasionally they seem to get stuck and I'd like to kill them, but don't want to risk stopping something that is still healthy.</p>
  
  <p>Having started down this path, it is probably more plain curiosity as to how to match up jobs and processes, since I'll most likely start rewriting some of these scripts in the near future.</p>