title: Include a PowerShell file inside a ScriptBlock
body: <p>I have written the following code</p>
  
  <pre><code>$sb = {
      . .\Myfunctions.ps1
      $x = MyFunction1
      $y = MyFunction2
      $x + $y
  }
  
  $cred = Get-Credential "domain\user"
  
  Invoke-Command -Computer localhost -Credentials $cred -ScriptBlock $sb
  </code></pre>
  
  <p>This does not work because it says The term .\MyFunctions.ps1 is not recognized as commandlet</p>
  
  <p>Why can't I include a file inside a script block?</p>