Saturday 24 January 2015

Map network share to a drive letter, permanently and reliably.


I often want to access a shared network folder as at drive letter. Using "subst", "net use", "visual subst" have given variable results. Often a drive letter would be randomly missing after a reboot, not show up in admin mode or kick in too late resulting in "drive X doesn't exist" style messages.

A google on the subject highlighted the DosDevice registry method.

http://en.wikipedia.org/wiki/SUBST#Method_3

It didn't seem clear on its use in network shares. So after a lot of experimentation I found something that worked.

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
"X:"="\\??\\UNC\\NetworkServer\\SharedFolder"

Copy the above to a .reg file, replace "NetworkServer", "SharedFolder" with your needs and run the reg.

Reboot and you are sorted. It will set up the drive letter on each reboot before anything gets launched. Both admin and user will see the drive letter. Bliss!

To verify, bring up a cmd prompt, enter "subst" and you should see something like:
X:\: => UNC\NetworkServer\SharedFolder