This project is read-only.

SUBST.EXE mapping to share, also considered a UNC share?

Developer
Feb 15, 2012 at 4:04 PM
Edited Jan 15, 2013 at 7:08 PM

To map a drive letter to a UNC path, one would do something like:

NET.EXE USE Y: \\server\share

(DosDeviceName; = "\Device\LanmanRedirector\;Y:000000000002de2c\server\share")


The same can be achieved by using:

SUBST.EXE USE Z: \\server\share

(DosDeviceName; = "\??\UNC\server\share")


Even the .NET DriveType enum reports drive Z: as a Network drive.


However, WNetGetUniversalName() seems to choke on this: ERROR_NO_NET_OR_BAD_PATH = 1203
Deleting the subst using NET.EXE /d will also report that no network drive can be found.

The AlphaFS implementation of the DriveInfo class supports unc shares/paths and thus has
the "IsUnc" property, for your convenience, which is not native to .NET.

Based on the aforementioned, a clear decision should be made to get a true value.
So, should we consider mappings created by SUBST.EXE, as true UNC mappings?

The answer is: no


It may sound like something you'll never run into, but as a sysadmin, one encounters
inventive solutions of others, which must be dealt with. :)

Feb 19, 2012 at 2:15 AM

that is interesting question.

I just tried subst to network drive and it worked, even though docs say it to be a junction, and junction cannot point to UNC path.

http://msdn.microsoft.com/en-us/library/aa363904%28v=vs.85%29.aspx

Explorer shows it as a "Disconnected Network Drive", even though it perfectly works.

Personally, if something is in question and not quite official it is definitely not 100% true, and should return false.