I am able to transfer files to a remote session, however I been pretty unsuccessful at retrieving files from it. The remote system is a Windows 7 machine with PowerShell v2.0, from Windows 10 Enterprise.
I was originally trying to retrieve a folder but now I decided to try something more simple, a simple text file until I get this working.
I believe the first error is a bug and the file should still copy. When I was transferring files to the remote machine it gave me the same error but the file still transferred over.
cmdlet: Copy-Item "C:\Users\Public\Test.txt" -Destination "C:\" -FromSession $session
Errors:
Copy-Item : Unable to index into an object of type System.IO.FileInfo.
At line:1 char:1
+ Copy-Item "C:\Users\Public\Test.txt" -Destination "C:\" -FromSession ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (0:Int32) [Copy-Item], RuntimeException
+ FullyQualifiedErrorId : CannotIndex
Copy-Item : Parameter attributes need to be a constant or a script block.
At line:1 char:1
+ Copy-Item "C:\Users\Public\Test.txt" -Destination "C:\" -FromSession ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Management.Automation.PowerShell:PowerShell) [Copy-Item], RemoteException
+ FullyQualifiedErrorId : CopyFileRemoteExecutionError,Microsoft.PowerShell.Commands.CopyItemCommand
Copy-Item : The term 'PSCopyFromSessionHelper' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Copy-Item "C:\Users\Public\Test.txt" -Destination "C:\" -FromSession ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Management.Automation.PowerShell:PowerShell) [Copy-Item], RemoteException
+ FullyQualifiedErrorId : CopyFileRemoteExecutionError,Microsoft.PowerShell.Commands.CopyItemCommand
Copy-Item : Failed to read remote file 'C:\Users\Public\Test.txt'.
At line:1 char:1
+ Copy-Item "C:\Users\Public\Test.txt" -Destination "C:\" -FromSession ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (C:\Users\Public\Test.txt:String) [Copy-Item], IOException
+ FullyQualifiedErrorId : CopyItemRemotelyFailedToReadFile,Microsoft.PowerShell.Commands.CopyItemCommand
I would really appreciate some help, thanks!