Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the local name of mapped network drives

Status
Not open for further replies.

c1utch

MIS
Jan 23, 2002
151
0
0
US
I am running a script that looks at the username and maps drives according to that user's group membership within Active Directory. Everything works fine, however I want to change the way the drives are labeled within "My Computer".

Currently, a network drive is labeled similar to the following:

Accounting on 'fileserver' (M:)

or

HR on 'fileserver\department shares' (H:)

(This depends on whether the folder is being shared directly or a parent folder is only being shared.)

Is there any way to change the way that these network drives are labeled after mapping them? Rather than the above, I would like them to simply say:

(H:) HR

or

(M:) Accounting

If this isn't possible, then minimally I would like the drive letter to be displayed first. I constantly refer users to drives by drive letter when troubleshooting problems over the phone. My users get lost when they don't see the drive letter displayed and only see the share.

Here is a sample of my script, I left out the portions of the script that don't pertain to this question.

'************************************************
'CREATE OBJECTS AND DEFINE VARIABLES
'************************************************
on error resume next
Set wshNetwork = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
set ofso=createobject("Scripting.filesystemobject")

strGroups = LCase(Join(CurrentUser.MemberOf))
'msgbox(strgroups)
MyUsername = Right(CurrentUser.Name, Len(CurrentUser.Name)-3)


'************************************************
'DELETE ALL NETWORK DRIVES
'************************************************
Set Drives = WshNetwork.EnumNetworkDrives

For i = 0 to Drives.Count - 1
on error resume next
wshNetwork.RemoveNetworkDrive Drives.Item(i)
Next

'***********************************************
'Drive Mappings
'***********************************************

If InStr(strgroups, "cn=fp human resources") Then
wshNetwork.MapNetworkDrive "H:", "\\fileserver\HR", "False"

End If

If InStr(strGroups, "cn=fp accounting") Then
wshNetwork.MapNetworkDrive "M:", "\\fileserver\department shares\Accounting", "False"

End If

**************************************************


Thank you in advance.


Chris
 
You may try to modify this registry value:
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\##ServerName#ShareName\_LabelFromReg

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Try this:

Code:
Dim objShell
Dim strDrive

Set objShell = CreateObject("Shell.Application")
strDrive = "H:\"

objShell.NameSpace(strDrive).Self.Name = "HR"

Spong
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top