Copy files via RDP without establishing a UI connection first (for automated jobs/no interaction required)

2

Is it possible to copy files via RDP without opening a connection via mstsc first (so no shared folders - at least not for manual copying - and no clipboard)?

I want to use, similar to FTP, network share or similar services, a mechanism that can be easily scripted and does not need UI/user interactions, since the functionality is to be used for a frequent update job.

Andreas Reiff

Posted 2018-07-11T12:43:02.063

Reputation: 895

Why would you want to use the Remote Desktop Protocol for that if you already know so many more suitable alternatives and shares like C$ are available? – Seth – 2018-07-11T12:44:29.753

Because the more suitable alternatives are all disabled on the target system. We have a VPN connection to it, allowing RDP, but even the target file share is not accessible, all online services on the target machine are forbidden. – Andreas Reiff – 2018-07-11T12:55:12.043

1Can you do it other way round? I mean, you can schedule a task on target system to access file share of your system. This task can keep pinging your IP after every few minutes and perform the job when PING is successful (VPN is connected from your system). Just a far fetched idea, never tried that. – Sandeep – 2018-07-11T13:53:23.493

@Sandeep Good idea, still, this is not working. Pinging works, but looks like file share is blocked. \IP times out with 0x80004005 (which I think can mean anything). – Andreas Reiff – 2018-07-11T14:05:16.637

Andreas Reiff - So from the RDP icon if you right click and select edit and then go to Local Resources > Local devices and resources > More > and then check the Drives (expand and pick one by one or select all (https://i.imgur.com/XamQhnY.png)), save that and then make the connection, you may find that the target system then will show those drives on the remote RDP session in file/Windows Explorer (https://i.imgur.com/KDh4DQs.png) and you can utilize this for your automation.... Easy enough to try so give a shot and let me know if that helps you any or not.

– Pimp Juice IT – 2018-07-11T14:55:18.340

1As far as I know, this is all done via the RDP TCP port 3389 or whatever so if it's already allowed, I'm not sure why this would not work but I'm curious what your results are after you give it a try and perhaps you can automate using this method for the file transfer instead. – Pimp Juice IT – 2018-07-11T14:56:25.620

@PimpJuiceIT I know of that possibilty, hence I mentioned it in the original post. I don't know though whether I can automatically log in from my system at a certain time and then access the shared folders from the other system a minute later. I don't know if there would be some consistent way to access them. Still, this would be quite a bit of work, requiring amongst other things to also stop the rdp connection (probably just a timed process kill). – Andreas Reiff – 2018-07-11T17:53:06.907

Okay, you said "no shared folders" and to me I interpret that as an SMB share like \\servername\sharename from client to host or vice versa and not the local devices and resources drive option I talked about. You state no clipboard too so I assume this means you cannot copy a file from one machine to another via the RDP session, correct? Or by that you mean text only from one app to another across RDP sessions? – Pimp Juice IT – 2018-07-12T05:58:57.540

Consider requesting the VPN admins to open an explicit ACL rule to allow the specific TCP port to/from the IP of the machine/subnet for a method you want to use since otherwise you cannot use anything but RDP alone without copying or clipboard functionality. If it's for something important, production, frequent and critical such a request should be justified and especially if you get management/executive approval. – Pimp Juice IT – 2018-07-12T05:58:59.840

I also spoted same problem, without resolve however. Sometimes you just cant open other ports, because as example we have mobile internet provider that explictly allows only RDP port, and you cant change it. – nuclear sweet – 2020-02-07T09:54:03.387

No answers