title: Copy-Item from New-PSDrive within PSSession
body: <p>I have the following Powershell code:</p>
  
  <pre><code>Enter-PSSession -ComputerName test01 
  New-PSDrive -Name Source -PSProvider FileSystem -Root \\test02\SMBTest -Credential test\Administrator 
  Copy-Item Source:\Test.txt -Destination C:\Temp
  Remove-PSDrive Source 
  Exit-PSSession
  </code></pre>
  
  <p>When I execute each line on it's own it works, but when I save it and run it as a ps1 file it doesn't do anything. </p>
  
  <p>Can anyone help explain why (I'm using Powershell --version 5.1)</p>