Transfer files with PowerShell Remoting

I am in progress to setup full server remotely from PowerShell command line. Now I have IIS installed, Tasks scheduled, .NET 4.0 installed and so on. What I need next is to get some files needed to setup application. I have them on my local computer. So few options here: a) updalod to Dropbox, and download them with PsGet b) Upload them with PowerShell Remoting. First option is too easy. So i decided to go with second.

Ok, so SHH can easy transfer files. What about PowerShell? Well, almost nothing. There is nothing built-in. In community I found two options: PModem File Transfer Protocol, should work, but unfortunately file with implementation is not here any more. So second option. Blog post More PowerShell Remoting is not strictly about transferring files, but it has nice idea. You can actually use Invoke-Command with script that will have file embedded as a string. Of course, this is not bad to have this idea packaged to PowerShell module. This is how PsRemoteFiles micro project started.


In short words, it takes file on client, encode it as base64, then generate script with encoded data included and execute it on the remote server. Easy!

copy-remoteItem Tests.ps1 -Credential "Comp1\User01" -ComputerName "Comp1"

For now, implementation is quite naїve, for example it loads file in memory twice. This is not really big problem if you have small files, but with big one… Anyway, next plans is to chunk file transfer. Also name does not seem to express what exactly this command do. So I have some work to do :).

Project home page is


. .


  1. chaliy posted this