General discussion

Locked

Rename Mapped Drives

By dwdino ·
Currently when I map network shares using logon script they show something similiar to the following:

accounting on ttrv-gfp1 (s:)

I know that I can manually right click on the mapped drive and rename it so it matches the following:

Accounting (s:)

What I am trying to do is develop a way to do this automatically through my login script. The script connects the drives using "net use" which has no provision for renaming the mapped drive. I have also attempted to use label which fails.

Does anyone have any ideas how to rename mapped drives using script/command line?

Thanks

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Rename Mapped Drives

by dwdino In reply to Rename Mapped Drives

Eureka!!!

I solved this in the following way:

1) map share with net use .........
2) immediately following run this:

regedit /s \\servershare\patch.reg

The patch.reg file has to be specific for the mapped share (I had to create 10).

The patch.reg file contains the following:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints\S\_LabelFromReg]
"Version"=dword:00000005
"LastUpdate"=dword:00091cb0
"Cache"=hex:43,00,65,00,6e,00,74,00,65,00,72,00,73,00,20,00,6f,00,66,00,20,00,\
45,00,78,00,63,00,65,00,6c,00,6c,00,65,00,6e,00,63,00,65,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

The structure is as follows:

Key: USER\Soft\MS\Windows\Current\Explorer\MountPoints\S\_LabelFromReg
("S" is the letter of the mapped drive. Corresponds to whatever drive letter is assigned with net use)

Version:
Works with any number greater than 1 it seems.

Last Update:
(not important)

Cache:
This is the string which will "label" the mapped drive. Is required to be in hex form so you will need a converter. (*note* if you replace the Cache key with a string type key named Cache it will convert to hex for you.)

Now my login script looks like the following:
#psuedocode#

ifmember group1
if error level 1 goto next
net use s: \\server\deptshare
regedit /s \\server\folder\group1.reg
:next
ifmember group2
if error level 1 goto next
net use s: \\server\deptshare
regedit /s \\server\folder\group2.reg
:next
...

This is working wonderfully. Now when users open "My Computer" they see Accounting (s:), Purchasing (p:)

Collapse -

Rename Mapped Drives

by Obersturnbanfuhrer In reply to Rename Mapped Drives

If you wish to map and rename in a logon script, use RenUse.bat. The syntax is:

RenUse "New Name" DriveLetter: \\ComputerName\ShareName [Options]

where:

"New Name" will display as New Name (DriveLetter:).
DriveLetter: is the drive letter you are mapping. Previous mappings will be replaced.
\\ComputerName\ShareName is the standard net use syntax.
[Options] are any additional net use switches that you want.

Note: this syntax is not mine, it's from Windows & .Net (I never try it yet)

Collapse -

Rename Mapped Drives

by Obersturnbanfuhrer In reply to Rename Mapped Drives

RenUse is a *.bat file. The script won't fit in this comment. The script is documented at http://www.jsifaq.com/SUBJ/tip4600/rh4601.htm

Collapse -

Rename Mapped Drives

by dwdino In reply to Rename Mapped Drives

Poster rated this answer

Collapse -

Rename Mapped Drives

by dwdino In reply to Rename Mapped Drives

This question was closed by the author

Back to Windows Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums