Discussion Locked

Map Network Drive in DFS

0 helpful
43 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

WITHOUT typing in a UNC name how can a user map to shares under a DFS mount point in Windows NT?

For example, is there a way to add Map Network Drive to the Right-click options at any level of browsing, not just at the share point itself?

I amlooking for a GUI based solution NOT NET USE at the command prompt or Typing in the UNC Name at the Map Network Drives dialogue box.

This is an advanced question for which I am willing to award advanced points, so please do not answer unless you truly understand the question.

43 replies

by hasse mcse/brainbench

Hi!

For your first question the answer is no.
In NT or Win95/98 you cannot map a network drive to anything else but the share itself.

It's not like in Novell where you coule map to M: \\myserver\data\home\usershomedir
Q: \\myserver\data\programs, when only data is shared so to speak.

This is impossible in Windows. Instead you need to create a share for all directories you wish to be able and map drives too.

I'm not quite sure I understand why you need to be able and map drives by a gui interface, but if you choose map network drive from explorer a windows pops up and in the lower part you can browse the network so in order to map a drive just double click on computer name you wanna connect to and then click on the share name you wanna connect too.

I don't think you can find a much better gui than that.

You can also browse using network neighbourhood and then right click and choose map network drive, this is enough GUI for me. If you need something else search for it at a site such as w

by curious_george

Your wrong. It is possible to map a network drive to a folder under a share using the unc path in the map to location if the NT system is SP3 or above, or has the DFS client in a Win9x system. See http://support.microsoft.com/support/kb/articles/q178/6/31.asp

You are correct that you get a Map Network Drive option when your Right Click a share during network browsing, but that option is not there once you are inside the share and that is what I want to appear on the right-click menu.

Have you ever used DFS, it is clear you know nothing about it? Your name implies that you are an MCSE, you should have know everything I have spelled out here. That's why I stated, "This is an advanced question for which I am willing to award advanced points, so please do not answer unless you truly understand the question."

by bizzo

Not a GUI solution I'm afraid, but someone may be able to build on it.

The command I think you may be looking for is SUBST, which will create a virtual drive. I say virtual because if you then right-click on the mapped letter, it does not give you the option to disconnect in the usual way, but you can delete the mapping.

For more information, see the NT help files:

Subst

Associates a path with a drive letter.
subst [drive1: [drive2:]path]
subst drive1: /d

Parameters

none
Used without parameters, subst displays the names of the virtual drives in effect.

drive1:
Specifies the virtual drive to which you want to assign a path.

drive2:
Specifies the physical drive that contains the specified path (if different from the current drive).

path
Specifies the path that you want to assign to a virtual drive.

/d
Deletes a virtual drive.

by curtis_davis

There are several API calls that you can use to map the drive through GUI app.
WNetAddConnection2(NRW,
null,null,connect_update_profile);
CONNECT_UPDATE_PROFILE := 0;
// Function breaks an existing network connection.
//WNetCancelConnection(pchar(Edit1.text),True); // will re-mapped on next connection
WNetCancelConnection2(pchar(Edit1.text),CONNECT_UPDATE_PROFILE,False); // premanent deletion on the mapped drive

by curious_george

This is true but I need to be able to add it to a built-in NT menu system. So what are the command calls to invoke the map drives dialog box.

by beairdj

I think I have the best solution...but it is not simple...I would recommend you 'slap' together a quick hta program. In that you could do the mapping (using net use) transparently. The hta program is a combo of HTML and script (I prefer VBScript, but JScript and others are support). The resource you need to make it all happen? http://cwashington.netreach.net/ (one of the better Script websites), and/or Windows Script Host (by Wrox). Both are great resources. You simple combine the "login Scipt" concept with a small HTA (HTML Applicaitn) and you have what you need.
Good luck with it!
-john

by bill.parks

I don't quite understand your end result, but hopefully this can help. All the previous answers are correct about mapping only a share point. If you server(s) don't contain a tremendous amount of shares, why not make shortcuts in Network Neighborhood for your users. Using either Policies or manually doing this, copy the shortcuts of the shares you want available to your users in the \\$userprofile%\nethood folder. They will show up in addition to your normal browsing and provide a GUI mechanismfor your users to map their drives...

by nbcasey

To answer you question, no. You cant map to any folder, just shares. The subst command will not work across the network. Since you want to be able to do this with a right click, here you go: Open regedit and browse to HKEY_CLASSES_ROOT\Directory\shell. Right click on the shell key and choose to make a new key. I called mine "Map to Z". Right click on the key you just created and create another new key called "Command". Set the default value for "Command" to ""c:\winnt\system32\net.exe" use z: "%1"". Close regedit. Now right click on any shared folder to map it.

by elmagoal

You can use subst command in a script(log on script) to map to any folder with in a share or several level down. Or make a new share and point it to the folder you want.

by john cranny

If you really want to do it via a right click option, you have to edit the registry.
I don't think you can actually specify a drive letter which isn't the next available one, but try this. It works!

1. Open regedit & navigate to the following path: HKEY_CLASSES_ROOT\Directory\Shell
2. If there is no Shell Key, you will have to create it.
3. Add a new key - MapNetworkDrive
4. Add another key - Command
5. You should now be at the following path:
HKEY_CLASSES_ROOT\Directory\Shell\MapNetworkDrive\Command
6. Change the "Command" keys' default value to "net use * %1"
7. Exit regedit
8. Open Explorer, navigate to the directory under the DFS share & right click. You will see the "MapNetworkDrive" option. Click it!
9. Finished..!
Note: if you replace the * with a drive name (eg z:) it will map the drive to Z

Good luck.

by curious_george

Not exactly what I was after because you don't get the option each time you run it to pick the letter for each drive mapping, but it is the closest to a functional answer I received.

by brucker

I think most of the answers you have received are missing something. It is correct that in straight Windows NT networking you cannot map a drive to an unshared folder. However, if you are using DFS in NT, you can map to any folder below the share aswell as the share itself. For example, if you a dfs root called DFSRoot and you have a share that has been connected to it called Public and below Public are several other folders that users have data in. You can go to the Tools menu in Explorer andclick "Map Network Drive" and navigate to the DFS root on the server hosting the service and then type in the Path line something like :
\\DFSHostSvr\DFSRoot\Public\SomeSubFolder\SomeSubFolder... and you will map to that particular folder without having to explicitly share it.
This comes with a caveat: you cannot do this with a right click as you ask without some knowledge of shell programming. I am not even sure it could be done.
So in summary, you can map at any level, but you cannot do it by right clicking and selecting Map Network Drive and you cannot do it from a menu.

by curious_george

I know all this already, that's why I asked the question. Thank you for enlightening the other members that didn't understand this concept prior to responding though. Now if you actually have an answer to the question, I'd be interested in the info.

by michelm

I can confirm, with DFS you can map to any directory you want, not only shares.

I never tried to map a share through a right but I would try the following approach:

REGEDIT4
[HKEY_CLASSES_ROOT\Folder\shell\CreateShare]
@="Map Share Here"
[HKEY_CLASSES_ROOT\Folder\shell\CreateShare\command]
@="C:\\WINNT\\System32\\cmd.exe /k net use x: "%1""

This example was derived from a "Command Promptz Here" so I have no idea if it works, but maybe it is a starting point.

regards

by rkelly

Hi,

the only way I have managed to do this is with Windows 2000 based a clients, these allow the abilty to map a drive at any level. So your users browse the DFS root then right click on the folder they wish to map to and they map at that point.
I have tried unsuccessfullt to do this for 12 months, then with the implementation of Windows 2000 clients on the network it worked a treat. I must stress that I also moved over to Windows 2000 based DFS servers.

Richard Kelly
Brainbench MVP Windows 2000 Migration
MCSE

by curious_george

Yeah I'm familiar with the W2K functionality and I've been hoping to find a way to make NT4 behave in a similar fashion to W2K. I have many servers and clients that can not be moved to a heterogeneous W2K environment yet though. So far only one answer here has been moderately helpful. Thanks for the product review though.

by rhall

I'm not going to give you a new answer, you actually have that here but I am going to provide you with a more complete answer.

I am using parts of answer #14 and #15 which gave me more ideas.

NOTE - Disclaimer - I think this is very dangerous and should only allow access for administrators that have a full understanding of the implications.

This assumes you have DFS installed on one of your servers and you have administrative rights and access to the DFS Admin.

Create volumes in DFSfor all of your NT servers and their respective drives. I called mine:

SERVERNAME_C
SERVERNAME_D

If your DFSROOT is called \\DFSSERVER\DFSROOT then you would see:
\\DFSSERVER\DFSROOT\SERVERNAME_C in Explorer.

If you then put in the following in the registry of the computer you are using:

1. Open regedit & navigate to the following path: HKEY_CLASSES_ROOT\Directory\Shell
2. If there is no Shell Key, you will have to create it.
3. Right click on Directory and select New, Key - Call it Shell
3. Right click on Shell and select New, Key - Call it MapNetworkDrive
4. Right click on MapNetworkDrive and select New, Key - Call it Command
5. You should now be at the following path:
HKEY_CLASSES_ROOT\Directory\Shell\MapNetworkDrive\Command
6. Change the "Command" keys' default value to "net use * %1" (do not type in the quotes, they will be added automatically)
7. Exit regedit

Now you can use explorer and go through Network Neighborhood as long as your DFS Root is shared and map a drive to any folder in your network without having to share it. Just right-click on it under the DFS structure and select MapNetworkDrive and bingo, your drive is mapped without any typing required. You can right click on the mapped drive and select DISCONNECT to unmap the drive.

Roland W. Hall
Senior Network Architect
Marine Drilling Companies
rhall@mardril.com

by curious_george

This is a descent answer but John Cranny already used it several answers up on the page. The only problem here is that you do not get the option to select a drive letter each time you designated a new mapping.

by seantu

How about using the subset command

ex: subst DriveLetter \\Servername\users\shared

by rravanelli

As the other answer explain to you, you can not map a network drive at any point but only on share point.
Therefore I have tried POWERDESK V 4.0.9.1 of ONTRACK Data International (the site is www.ontrack.com)a very powerful utility and I found the product very interesting, try it and let me know.
BYE

by computerdude

See Microsofts knowledgebase article Q178631. I think this is what you are looking for. I have mapped to a un-shared folder under a DFS root succesfully. The article explains it all. And you can use the GUI for mapping drives like you would any other. Hope this helps.

Dave

by curious_george

I've read every piece of info I could find from MS including this one, prior to posting this question, you;ll note that I requested, "I am looking for a GUI based solution NOT NET USE at the command prompt or Typing in the UNC Name at the Map Network Drives dialogue box." in my question and this article describes "Typing in the UNC Name at the Map Network Drives dialogue box".

This discussion is closed to new replies.