Set user friendly name on mapped drives - VBS

Posted on 2011-05-11
Last Modified: 2012-05-11

I have a logon script mapping drives to the users.

How do I in VBScript set a user friendly name on the share?

For example user on (\\server\share) (H:) to Home (H:)...

Thanks in advance


Question by:mikeydk
    LVL 25

    Assisted Solution

    by:Luis Pérez
    Mmmm... try this: once the drive has been mapped, use this API function:

    Private Declare Function SetVolumeLabel Lib "kernel32" Alias _
    "SetVolumeLabelA" (ByVal lpRootPathName As String, _
    ByVal lpVolumeName As String) As Long

    You can use it this way:
    Call SetVolumeLabel("H:","Home")

    Hope that helps.
    LVL 65

    Accepted Solution


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Welcome to part one of a multi-part tutorial series, VBScript for Windows System Administrators.  The goal of this series is to teach non-programmers how to write useful VBS code to automate their environment, and perform tasks faster, and in a more…
    Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now