title: input objects in powershell jobs
body: <p>I'm trying to implement a job in PowerShell that would look something like this:</p>
  
  <pre><code>$cred = Get-Credential 
  $job1 = Start-Job -InputObject $cred -ScriptBlock {
      Get-ADUser -Credential $cred -Filter *
  }
  $res1 = Wait-Job -Job $job1 | Receive-Job
  </code></pre>
  
  <p>But I am receiving an error message:</p>
  
  <p>"Wait-Job : The Wait-Job cmdlet cannot finish working, because one or more jobs are blocked waiting for user interaction.  Process interactive job output by using the Receive-Job cmdlet, and then try again.
  ....
  Deadlock detected: (System.Manageme...n.PSRemotingJob:PSRemotingJob) [Wait-J 
     ob], 
  ....
  "</p>
  
  <p>But if I create this seemingly identical job like this:</p>
  
  <pre><code>$job2 = Start-Job -ScriptBlock {
      $pass = ConvertTo-SecureString "pass" -AsPlainText -Force
      $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "usr",$pass
  
      Get-ADUser -Credential $cred -Filter *
  }
  $res2 = Wait-Job -Job $job2 | Receive-Job
  </code></pre>
  
  <p>Everything works perfectly.</p>
  
  <p>Can you please help me understand why?</p>
  
  <p>Thanks!</p>