title: Execute script file over ssh from powershell on windows
body: <p>There is this solution to execute a shell script from a file. All good.</p>
  <p><a href="https://stackoverflow.com/questions/305035/how-to-use-ssh-to-run-a-local-shell-script-on-a-remote-machine">How to use SSH to run a local shell script on a remote machine?</a></p>
  <p>On Windows in <code>cmd</code> these 2 commands do the same and <strong>they both work</strong></p>
  <pre class="lang-bash prettyprint-override"><code>cat .\my_script.sh | ssh user@ssh.server.com &quot;bash -s&quot;
  ssh user@ssh.server.com &quot;bash -s&quot; &lt; .\my_script.sh
  </code></pre>
  <p><strong>How can I run the same in</strong> <code>powershell</code> in a  similar way(using pipes) and not using any <code>Get-Ouput</code> and weird <code>powershell</code> commands?</p>
  <p>If I run this script over powershell I get an error</p>
  <pre class="lang-bash prettyprint-override"><code>cat .\my_script.sh | ssh user@ssh.server.com &quot;bash -s&quot;
  </code></pre>
  <pre class="lang-bash prettyprint-override"><code>bash: line 3: $'\r': command not found
  ' does not existuru
  bash: line 6: $'\r': command not found
  bash: line 12: $'\r': command not found
  </code></pre>