This page looks best with JavaScript enabled

Persistent Drive Mapping In Windows 2012

 ·   ·  ☕ 2 min read

Problem

By experiment, I discovered that Visual Subst no longer works in Windows Server 2012, as good as it did in previous versions of the OS.
Specifically for the purpose of referencing a DLL from a locally mapped drive. See below for more information.

Assumption

In Windows 2012, 32-bit and 64-bit processes use separate network drive mapping (later - Z:). Did not find a confirmation on the internet.

Research

32-bit processes understand subst command, 64-bit need something else. Explorer seems to add 64-bit mapping through its interface. Did not find an equivalent in command prompt.
By experiment, I found that Visual Subst utility (free download off the internet) adds 64-bit drive mapping in Windows 2012. In prior OS (Windows 7 etc.), it adds both.

Without 64-bit drive mapping the drives are not visible in Explorer (and other 64-bit apps of course, such as Total Commander etc.)

Without 32-bit drive mapping Visual Studio cannot link anything from Z:, because VS is x86 and the Z: drive is not there to select.
Sometimes it comes up, then on next solution startup it goes away. 95% of the time it won’t be there, unless a SUBST command was used.

Workaround

Add 32-bit mappings using SUBST command, then add 64-bit mappings using Explorer or Visual Subst.

Solution

To make persistent SUBST for both 32-bit and 64-bit in Windows Server 2012:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices" /v Z: /t REG_SZ /d "\??\C:\MyFolder" /f

Where C:\MyFolder is the folder you want to map.

Credit goes here:
http://superuser.com/questions/217561/why-is-a-subst-drive-usable-from-a-command-prompt-but-not-windows-7-explorer


Victor Zakharov
WRITTEN BY
Victor Zakharov
Web Developer (Angular/.NET)