Home > Windows Server Tips > Windows Systems and Network Administration > Use VBScript to rename mapped drives
Windows Server Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

WINDOWS SYSTEMS AND NETWORK ADMINISTRATION

Use VBScript to rename mapped drives


Rahul Shah, Contributor
08.30.2006
Rating: -4.67- (out of 5)


Expert advice on Windows-based systems and hardware
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


On occasion, an administrator may need to change drive-mapping names to hide share paths or to make the drive name user-friendly. If done manually through a console, this is a simple-enough operation.

But try to automate the task and it gets more difficult. Because mapped drives are not partitions on the local hard disk, common DOS commands can't be used. Most drive-mapping commands, such as net use, don't have a way to customize the name of the mapped drive either.

One way to perform this task is to hack the following Registry key and add the _LabelFromReg string value:

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\%key%

Here, the %key% variable is the drive letter to be changed.

There are several ways to make this method work. You can edit the Registry directly, via script, or by importing a .reg file using regedit/c. But all these methods require many steps and some require external files, and so they might not fit into every administrative scheme. Here's an easier approach.

Using a VBScript can make this task more seam


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Windows Systems and Network Administration
Common causes of Windows server security vulnerabilities
Cutting the cost of Windows identity and access management
Using NTFS on a non-Windows OS with NTFS-3G
Group Policy Object modeling simplifies network security
Implementing simple Network Access Protection for Windows Server 2008
Immediate steps for Windows disaster recovery
Tips for Windows domain controller optimization
Quick hits: Troubleshooting service account failure, batch job execution
Case Study: Troubleshooting Windows service dependency failures
Troubleshooting common Windows service failures

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


less. This simple script can be used on mapped drives as well as local partitions:

To use this trick, simply edit the script to change the drive letter and drive name as desired. For example, if Z: is a mapped drive that has the label "Backup of all servers" and you want to change the label on the mapped drive to simply Backup , change this line:

mDrive = "drive letter"

to this:

mDrive = "z:\" Then, change this line:

oShell.NameSpace(mDrive).Self.Name = "AnyName"

to this:

oShell.NameSpace(mDrive).Self.Name = "Backup"

Finally, run the script by creating a shortcut to it and double-clicking on the shortcut, either by calling it from a logon script or by any other method suitable for your environment.

About the author: Rahul Shah currently works at a software firm in India, where he is a systems administrator maintaining Windows servers. He has also worked for various software firms in testing and analytics, and also has experiences deploying client/server applications in different Windows configurations.

More information on this topic:

Rate this Tip
To rate tips, you must be a member of SearchWindowsServer.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Server Room Design - Planning, Cooling, Maintenance
HomeTopicsBlogsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2004 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts