5

I'm having some difficulty getting the Folder Redirection feature of Microsoft Remote Desktop to work with command line applications.

  • The server machine is running Windows 2008R2.
  • The client machine is OS X Yosemite, running Microsoft Remote Desktop Version 8.0.12 (Build 25282)

I have configured a folder for redirection in the OS X RDP client, with the 'name' field as 'andrew', and the 'path' field as /Users/andrew. This works correctly. When I connect to the server, I see the redirected folder under 'Computer', and I can browse it graphically. From the command prompt, NET USE also shows it:

C:\Users\Administrator>net use
New connections will not be remembered.


Status       Local     Remote                    Network

-------------------------------------------------------------------------------
                       \\TSCLIENT\andrew         Microsoft Terminal Services
The command completed successfully.

However, there is no drive letter associated with the folder. This is a blocker for me. The whole point of this redirection is to allow me to use command line build utilities on the Windows machine, but edit and manipulate source code on the Mac. The cmd.exe shell cannot handle UNC paths, and powershell is not an option as the build utilities inevitably shell out to cmd to do things like run vcvars, etc., which then fails if CWD is a UNC path. So, sadly, I really need a drive letter mapped or this is a no-go.

If I attempt to use NET USE or the graphical "Map network drive" to establish a drive letter it appears to work:

C:\Users\Administrator>net use Y: \\TSCLIENT\andrew
The command completed successfully.

And re-running NET USE shows the drive as present:

C:\Users\Administrator>net use New connections will not be remembered.

Status       Local     Remote                    Network

-------------------------------------------------------------------------------
             Y:        \\TSCLIENT\andrew         Microsoft Terminal Services
                       \\TSCLIENT\andrew         Microsoft Terminal Services
The command completed successfully.

However, if I attempt to actually access the Y drive, it doesn't work:

C:\Users\Administrator>y:
The device is not connected.

Subsequently, if I attempt to access the originally working redirected folder from the graphical shell, I find that it is no longer functioning correctly either. I now get a dialog saying

\\tsclient\andrew is not accessible. You might not have permissions to use this network resource.
Contact the administrator of this server to find out if you have access permissions.

Attempt to access invalid address.

It appears that I am not the only person who has encountered this difficulty, but the "answer" there is singularly unhelpful, as is the documentation to which it links.

Without a drive letter the folder redirection is not useable for my needs, but it would be hugely helpful if there is a way to make this work.

Any ideas? This would get me out of the need to rsync my sources around while testing on Windows, which would be an enormous productivity gain.

  • 1
    Fire up powershell and use that instead of the ole cmd.exe. Powershell can work with network paths just fine. Just start powershell, do a cd \\tsclient\andrew, then issue your commands. – Zoredache Jan 7 '15 at 1:00
  • 1
    @Zoredache Please read what I wrote. Powershell doesn't work, because the commands that I need to run will subsequently invoke vcvars.bat or similar cmd.exe driven things. Which then fail when running with a UNC CWD. – acm Jan 7 '15 at 1:53
  • 1
    As a workaround, can you create a \\mymac\andrew share using SMB/Samba and map the driveletter to that instead? (I'm not sufficiently experienced with Macs to know how much they support SMB/CIFS, but I'm assuming there must be some.) – Celery Man Jan 10 '15 at 23:11
6

Use a symlink instead of a drive letter, put the following in a .BAT at logon to the TS server:

MKLINK /D C:\Andrew \\tsclient\Andrew

This symlink will be persistent across reboots and would remove the requirement for a drive letter.

  • This allowed me to use robocopy over RDP from Windows 7 -> Windows 10. – Holistic Developer Feb 21 '18 at 17:45
0

Start a new RDP session (after logging out from the current session). Then, create the a batch file containing these lines:

net use \\tsclient\andrew /delete /persistent:yes
net use \\tsclient\andrew /delete
net use y: \\tsclient\andrew

Run that batch file.

  • This doesn't help. Even attempting to map the drive only after connecting via RDP makes the share disappear. – mklement Nov 19 '15 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.