Bug: Copy-Item -FromSession Fails if Local Machine Doesn't Have the Drive Being Copied From
In the title. If you copy from the F:\ drive on the remote machine and the local machine doesn't have an F:\ drive, failure mode ensues.
Bob wants to copy a
"F:\PowerShell" on RemoteServer to
"C:\Users\Bob" on LocalMachine.
$Session = New-PSSession -ComputerName RemoteServer -Credential (Get-Credential RemoteDomain\Bob)
Copy-Item -FromSession $Session -Path "F:\PowerShell\Test.txt" -Destination "C:\Users\Bob"
> Copy-Item : A parameter cannot be found that matches parameter name 'FromSession'.
- Bob has full permissions to both the F:\ drive and the file on RemoteServer.
- Bob is able to successfully copy files from C:\ and D:\ on the RemoteServer to LocalMachine.
- LocalMachine has both a C and D drive, but no F drive.
- Bob is able to copy items successfully from LocalMachine to RemoteServer's F drive.
Is anyone else able to reproduce this error? Is this expected behavior? I'm unable to think of a good reason for this.
I did a little test using build 14342 of windows 10 (PSVersion 5.1.14342.1000).
It seems that the issue is resolved.
Josh Castillo commented
This error also occurs with the -ToSession parameter. Though, creating a dummy folder on the source machine does not overcome this error.
OS: Windows Server 2008 R2