title: Invoking psftp using powershell
body: <p>My powershell code does not work when invoking PSFTP commands:</p>
  
  <p>current code:</p>
  
  <pre><code>    invoke-expression "psftp.exe -i key.ppk ubuntu@remoteserver -be b sftpcommands.txt &gt; logs.log"
  </code></pre>
  
  <p>I have tried the following:</p>
  
  <pre><code>    invoke-command "psftp.exe -i key.ppk ubuntu@remoteserver -be b sftpcommands.txt &gt; logs.log"
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>    Start-Process -Wait -FilePath "psftp.exe -i key.ppk ubuntu@remoteserver -be b sftpcommands.txt &gt; logs.log"
  </code></pre>
  
  <p>Running this in cmd prompt without the use of powershell works fine</p>
  
  <pre><code>    psftp.exe -i key.ppk ubuntu@remoteserver -be b sftpcommands.txt &gt; logs.log
  </code></pre>