Renaming a mapped drive

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
Posts: 6
Joined: Mon Nov 19, 2012 8:22 pm
Location: Worcestershire, UK

Renaming a mapped drive

Post by Clive.Hillier »

I am currently revising our logon script to include mapped drives to SharePoint 2010 document libraries & due to how the drives are named I wish to change them to something more obvious to the end user.

I have tried the following but it fails to work when I run the script:

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

If I check the registry key


it is showing on one of the machines but others fail to display this key. If I add the key & the _LabelFromReg data it still does not change the name.

Does anyone have any ideas on a way that this can be achieved to rename the mapped drive?