No announcement yet.

Renaming The Mapped Drive

  • Filter
  • Time
  • Show
Clear All
new posts

  • Renaming The Mapped Drive

    Anyone have an idea how to rename the mapped drive in this script. My old script (not listed) was able to rename it but I needed to mask the password so I rewrote the script and found\downloaded this .DLL file that someone created that allows the password to be masked. It uses different code so my old code is not working with it.

    I found this .DLL at

    I want to name the Drive "AUM Common"


    Option Explicit
    Dim objPassDlg
    Dim WshNetwork
    Dim strMessage
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    Set objPassDlg = CreateObject("PassDlg.LogonDialog")
    strMessage = MsgBox("Will you need AUM's Common Drive Today?", 36, "Welcome To AWA DET")
    If strMessage = 7 Then WScript.Quit
    objPassDlg.Confirm = True
    objPassDlg.ShowDialog "Connecting to AUM's Common Drive"
    If objPassDlg.Canceled Then
    'Wscript.Echo "Cancelled"
    WshNetwork.MapNetworkDrive "K:", "\\\Common", False, objPassDlg.UserName, objPassDlg.Password
    End If

  • #2
    Re: Renaming The Mapped Drive

    Manage the Name using vbs:
    ( )
    sDriveLetter = "K:" 
    sLabel = "AUM Common" 
    WshNetwork.MapNetworkDrive sDriveLetter, "\\\Common", False, objPassDlg.UserName, objPassDlg.Password
      Set objShell = CreateObject("Shell.Application") 
      objShell.NameSpace(sDriveLetter).Self.Name = sLabel 
    End If
    The name will be saved in "_LabelFromReg" in
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explore r\MountP*oints2\##server#share#folder\_LabelFromReg

    - - - - - - -
    Instead of using an third party DLL, you can also create with vbs a customized Inputbox in IE;
    You can combine that with your earlier script;


    This posting is provided "AS IS" with no warranties, and confers no rights.


    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts


    • #3
      Re: Renaming The Mapped Drive

      Hey itís working good now!!! I was close before when I tried to do it on my own. But I see you did somethingís a little differently than I was trying. The IE way looks cool but I think thatís beyond my level of scripting to get it to look and feel the way I want it.

      Thanks very much for your help and quick response!!!


      • #4
        Re: Thanks for sharing

        Thanks for sharing your answer with us! I'm sure others will also benefit from knowing what was wrong and how you fixed it.

        However, we'de appreciate it if you could grant some reputation points to the user that helped you. Just click on the little Yin-Yang icon on the right of the user's answer and follow the prompt.

        Daniel Petri
        Microsoft Most Valuable Professional - Active Directory Directory Services