Grab our RSS feeds Follow us on Twitter Join our Facebook Group Connect with us on LinkedIn
myITforum.com, Powered by You.
you are not logged in

Articles

Newslinks

Links

Downloads

Site Services

Community Forums

Discussion Lists

Article Search

Newsletter

Web Blogs

FAQs

Live Support

myITforum TV

Take a Poll

Monthly Drawing

myITforum Network

User Group Directory

Our Partners

About Us

Register

Login

BRONZE PARTNER:

BRONZE PARTNER:



Industry News:




  Home : Articles : Scripting print | email | | Forums |   print | email | | Blogs |   print | email | | Wiki |   print | email | | FAQs |   print | email | Article Search  
Renaming Mapped Drives


Bookmark and Share

By: Michael Brainard
Posted On: 1/7/2004

Have you ever had the need to change drive mapping names to hide share paths or to make the drive name user friendly?

This is an easy operation when done manually through a console but when trying to automate this task it becomes a little more difficult. Due to the fact that it is not a partition on the local hard drive, common DOS commands such as LABEL do not work with mapped drives. Most drive mapping commands such as NET USE have no way to customize the name either.

One common method of performing this task is to edit the following registry key.

==============================================================
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\%key%
Add String Value _LabelFromReg
==============================================================

NOTE: The %key% variable is the drive letter to be changed.

There is a whole host of ways to make this method work either by editing the registry directly via script or by importing a .REG file using Regedit /c. Any of these methods require many steps and some require external files so they may not fit into every administrative scheme.

As it turns out, our old friend VB Script can be used to make this task a little more seamless. The script can be used on mapped drives as well as local partitions and the only data to change is the drive letter and the drive name.

===============================================================
mDrive = "AnyDrive"
Set oShell = CreateObject("Shell.Application")
oShell.NameSpace(mDrive).Self.Name = "AnyName"
===============================================================

Example
===============================================================
mDrive = "d:\"
Set oShell = CreateObject("Shell.Application")
oShell.NameSpace(mDrive).Self.Name = "Data"
===============================================================

  myITforum.com ©2010 | Legal | Privacy