Copying files to and from remote sessions

Those of you running Windows 10 or Server vNext (I’ve yet check WMF 5.0 RTM on other operating systems after it was pulled by Microsoft from DownloadCenter), may have missed the inclusion of new parameters for Copy-Item, which allow to copying of files to a remote session and from a remote session. These are names ToSession and FromSession respectively.

Oddly, Microsoft do not appear to have updated their help to provide information on this. You’ll only notice it if you use Get-Command or alternatively tab through Copy-Item.

What’s nice is that PowerShell 5 is not required to be installed on the system for which we have created a remote session.

Usage is simply a case of providing a valid value of PSSession type to the ToSession or FromSession parameters, in addition to your standard Path and Destination parameters.

Examples are below :

Copy Remote Sessions

Unfortunately at present, FromSession and ToSession are mutually exclusive, preventing the possibility of being able to directly copy from one remote session to another.

Leave a Reply

Your email address will not be published. Required fields are marked *