title: Noninteractive Remote Commands with Powershell
body: <p>I am developing a script which uses ssh to connect to a windows host, run a powershell command, and parse the output. While I can connect to the host and run the command, powershell will not exit and return control back to the local script until I press the enter key.</p>
  
  <p>At the moment, the specific command being run is <code>ssh HOSTNAME 'echo $(hostname)'</code> and the ssh server is configured to pass remote execution requests to <code>powershell -noninteractive -command CMD</code>, where <code>HOSTNAME</code> is the name of the windows host and <code>CMD</code> is the remote command to be run (in this case <code>echo $(hostname)</code>).</p>
  
  <p>The end goal is to have the script which is calling remote powershell commands to run completely noninteractively, but this is currently impossible as the powershell command will not run noninteractively.</p>
  
  <p>How do I get powershell to run remote commands noninteractively?</p>