Windows – Cannot map drive letter to redirected folder when using Microsoft Remote Desktop

folder-redirectionmappeddriverdpwindows

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.

Best Answer

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.