title: Powershell start-job -scriptblock cannot recognize the function defined in the same file?
body: <p>I have the following code.</p>
  
  <pre><code>function createZip
  {
  Param ([String]$source, [String]$zipfile)
  Process { echo "zip: $source`n     --&gt; $zipfile" }
  }
  
  try {
      Start-Job -ScriptBlock { createZip "abd" "acd" } 
  }
  catch {
      $_ | fl * -force
  }
  Get-Job | Wait-Job 
  Get-Job | receive-job 
  Get-Job | Remove-Job 
  </code></pre>
  
  <p>However, the script returns the following error.</p>
  
  <pre><code>Id              Name            State      HasMoreData     Location             Command                  
  --              ----            -----      -----------     --------             -------                  
  309             Job309          Running    True            localhost            createZip "a...
  309             Job309          Failed     False           localhost            createZip "a...
  Receive-Job : The term 'createZip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
  At line:17 char:22
  + Get-Job | receive-job &lt;&lt;&lt;&lt;  
      + CategoryInfo          : ObjectNotFound: (function:createZip:String) [Receive-Job], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
  </code></pre>
  
  <p>It seems the function name cannot be recognized inside the script block of <code>start-job</code>. I tried <code>function:createZip</code> too.</p>