+ Post New Thread
Results 1 to 7 of 7
Windows 8 Thread, Drive Mapping Problem in Technical; Hi folks, I've got a drive mapping via script issue... On my PC there are 4 scripts that run to ...
  1. #1
    Gongalong's Avatar
    Join Date
    Oct 2011
    Location
    United Kingdom
    Posts
    904
    Thank Post
    816
    Thanked 19 Times in 17 Posts
    Rep Power
    10

    Question Drive Mapping Problem

    Hi folks,

    I've got a drive mapping via script issue...

    On my PC there are 4 scripts that run to map drives. These are legacy scripts from when I started working here, and are linked with GPOs. One is specific to IT support, and the others are standards scripts that are running on other staff PCs without issue. I don't think this happened immediately when I switched to Windows 8, so perhaps it was when upgrading to 8.1, but now two of the scripts fail with a "The local device name is already in use" error.

    I've done the usual, and checked the drives aren't already mapped, and that they aren't assigned to other devices. Neither seem to be the case.

    When I check the drive listings, disconnect the problem drive letters, and run the scripts again, they run without issue (!).

    For reference purposes the first script maps F, G, H, I, L, M, P, and R. It fails at P.

    The second script maps T, V, W, Y, and Z. It fails at T.

    Any ideas on what might be causing this?

    TIA

  2. #2
    AButters's Avatar
    Join Date
    Feb 2012
    Location
    Wales
    Posts
    477
    Thank Post
    143
    Thanked 107 Times in 82 Posts
    Rep Power
    42
    As you're having trouble with your existing scripts - now may be a good time to move to drive mapping via GPO? It's really easy and so far here 100% reliable. Have not needed to use log in scripts for ages (except the odd occasion when I want to copy a file or something, but even that can be done with GPO nowadays!).

    GPMC > User Configuration > Preferences > Windows Settings > Drive Maps

    Add each of your drive maps as "replace" and then get rid of your login script's from the users. You can also Hide drives if you need to e.g I've got my SIMS and public apps drives hidden.

    That's my 2p anyway!
    Last edited by AButters; 12th November 2013 at 09:49 AM.

  3. Thanks to AButters from:

    Gongalong (13th November 2013)

  4. #3
    Duke5A's Avatar
    Join Date
    Jul 2010
    Posts
    806
    Thank Post
    83
    Thanked 132 Times in 115 Posts
    Blog Entries
    8
    Rep Power
    32
    Is your script written in VB? I had something similar to this happen a couple years ago and wound up adding a couple lines to the script to disconnect drives if it detected they were already in use.

    Another thing I could possibly think of is the drive letter is in use by a card reader or sort and it's hidden in Explorer since there is no media in it.

  5. Thanks to Duke5A from:

    Gongalong (13th November 2013)

  6. #4
    Gongalong's Avatar
    Join Date
    Oct 2011
    Location
    United Kingdom
    Posts
    904
    Thank Post
    816
    Thanked 19 Times in 17 Posts
    Rep Power
    10
    AButters: yep, I'd like to. There's just not been a convenient time to trial it.

    Duke5A: yes, they're in VB. The script sets a bunch of values i.e. the drive letter, the path, and the assigned name. It then uses a CreateObject("WScript.Network") with a CreateObject("Shell.Application") to map and name the drives.

    I found after all that for one of the scripts the drive *had* been mapped, hence the conflict. But not for the second script, which maps T, V, W, Y, and Z, and fails at T.

    Oddly the scripts take 5 or so minutes before they actually execute, so I sat watching Windows Explorer this morning to see if it gave any clues as to what was going on, but bizarrely T mapped without error. If it comes back I'll revist.

  7. #5

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,785
    Thank Post
    3,292
    Thanked 1,054 Times in 975 Posts
    Rep Power
    365
    Could do with posting both scripts - also how come they are separate scripts, why not put them into one script ? Just out of curiosity ?

  8. Thanks to mac_shinobi from:

    Gongalong (13th November 2013)

  9. #6
    Gongalong's Avatar
    Join Date
    Oct 2011
    Location
    United Kingdom
    Posts
    904
    Thank Post
    816
    Thanked 19 Times in 17 Posts
    Rep Power
    10
    The scripts are GPO dependent i.e. it depends who you are as to what you get.

    Script as follows. I've taken out the share paths and names (not that I'm paranoid...):

    Option Explicit
    Dim objNetwork, strDrive, objShell, objUNC
    Dim strRemotePath1, strRemotePath2, strRemotePath3, strRemotePath4, strRemotePath5
    Dim strDriveLetter1, strDriveLetter2, strDriveLetter3, strDriveLetter4, strDriveLetter5
    Dim strNewName1, strNewName2, strNewName3, strNewName4, strNewName5
    '
    strDriveLetter1 = "T:"
    strDriveLetter2 = "V:"
    strDriveLetter3 = "W:"
    strDriveLetter4 = "Y:"
    strDriveLetter5 = "Z:"

    strRemotePath1 = "UNC Share Path"
    strRemotePath2 = "UNC Share Path"
    strRemotePath3 = "UNC Share Path"
    strRemotePath4 = "UNC Share Path"
    strRemotePath5 = "UNC Share Path"

    strNewName1 = "Share Name"
    strNewName2 = "Share Name"
    strNewName3 = "Share Name"
    strNewName4 = "Share Name"
    strNewName5 = "Share Name"

    ' Section to map the network drives
    Set objNetwork = CreateObject("WScript.Network")
    objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
    objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
    objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3
    objNetwork.MapNetworkDrive strDriveLetter4, strRemotePath4
    objNetwork.MapNetworkDrive strDriveLetter5, strRemotePath5

    ' Section which actually (re)names the Mapped Drive
    Set objShell = CreateObject("Shell.Application")
    objShell.NameSpace(strDriveLetter1).Self.Name = strNewName1
    objShell.NameSpace(strDriveLetter2).Self.Name = strNewName2
    objShell.NameSpace(strDriveLetter3).Self.Name = strNewName3
    objShell.NameSpace(strDriveLetter4).Self.Name = strNewName4
    objShell.NameSpace(strDriveLetter5).Self.Name = strNewName5

    ' End of script.

  10. #7


    Join Date
    Mar 2009
    Location
    Leeds
    Posts
    6,621
    Thank Post
    229
    Thanked 860 Times in 738 Posts
    Rep Power
    297
    when I used vbs for drive maps I used to use this which removes them first
    Code:
    'drive-print.vbs Jonathan 19-09-08
    Option Explicit
    Dim objNetwork, objShell
    Set objNetwork = CreateObject("WScript.Network")
    
    On Error Resume Next
    'map user drives
    
    objNetwork.RemoveNetworkDrive "U:"
    objNetwork.RemoveNetworkDrive "R:"
    objNetwork.RemoveNetworkDrive "V:"
    
    objNetwork.MapNetworkDrive "U:", "\\server\users$\staff\" & objNetwork.UserName
    objNetwork.MapNetworkDrive "R:", "\\server\Resources$"
    objNetwork.MapNetworkDrive "V:", "\\server\users$"
    
    'map printers
    Set objNetwork = CreateObject("WScript.Network") 
    objNetwork.AddWindowsPrinterConnection "\\server\colour1"
    objNetwork.AddWindowsPrinterConnection "\\server\laser1"
    'objNetwork.AddWindowsPrinterConnection "\\server\cedar"
    objNetwork.SetDefaultPrinter "\\server\Laser1"

  11. Thanks to sted from:

    Gongalong (13th November 2013)

SHARE:
+ Post New Thread

Similar Threads

  1. Weird drive mapping problem
    By laserblazer in forum Wired Networks
    Replies: 1
    Last Post: 27th April 2013, 06:08 AM
  2. Just setting up HAP+ Home Drive mapping problem
    By Cools in forum Home Access Plus+
    Replies: 4
    Last Post: 16th February 2012, 08:31 PM
  3. Home Drive Mapping Problem
    By fiza in forum Windows Server 2000/2003
    Replies: 5
    Last Post: 21st April 2011, 09:19 AM
  4. Home Folder Drive Mapping Problem
    By doomslagen in forum Windows Server 2000/2003
    Replies: 2
    Last Post: 15th April 2010, 08:08 PM
  5. Card Readers and Drive Mapping
    By mmoseley in forum Network and Classroom Management
    Replies: 12
    Last Post: 7th August 2007, 11:33 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •