title: Code in Job's Script Block after Start-Process Does not Execute
body: <p>When I create a automation script with PowerShell 5.1, I got an issue – in a script block of a job, the code after Start-Process will not get chance to execute. Here’s a simple repro:</p>
  
  <p><strong>Step 1 >> Prepare a .cmd file for Start-Process, the code in callee.cmd is:</strong></p>
  
  <pre><code>@echo off
  echo "Callee is executing ..."
  exit /B 0
  </code></pre>
  
  <p><strong>Step 2 >> Prepare the PowerShell code,</strong></p>
  
  <pre><code>$scriptBlock = {
      $res = Start-Process -FilePath "cmd.exe" -Wait -PassThru -NoNewWindow -ArgumentList "/c .\callee.cmd"
      throw "ERROR!"
  }
  
  $job = Start-Job -ScriptBlock $scriptBlock
  Wait-Job $job
  Receive-Job $job
  Write-Host($job.State)
  </code></pre>
  
  <p><strong>Step 3 >> Run the PowerShell script, the output on screen is:</strong></p>
  
  <pre><code>Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
  --     ----            -------------   -----         -----------     --------             -------
  1      Job1            BackgroundJob   Completed     True            localhost            ...
  Completed
  </code></pre>
  
  <p>The expected value should be “Failed”.
  Does my code have problem or I’m using jobs in a wrong way?</p>