How to manage disk drive letter when conflicting with network drive ?

E

Eric

Hello,

we have some users that are not local admin in Windows XP SP2.

We have several network drives mappend on this computer when the user logon (E drive to K). (I precise I cannot change those letters)

I know this KB http://support.microsoft.com/default.aspx?scid=kb;en-us;297694 , and I have installed the hotfix but it is not working in every situations.

Indeed, Windows XP remembers the letter assigned to the removable media the first time we introduce it.

So, if the first time that I plug my USB key I am out of office (so with no network drive mapped), the letter assigned will be the E drive; and then if I go back to work and I plug again my USB key, the letter assigned will be the E: (even with the hotfix installed) but the E: drive will already be assigned to my network share.

Am I misunderstanding something ?

Do you know if there is any solution for that ? (as the helpdesk has quite a lot of calls just because of this).

Thanks :)
 
P

Pegasus [MVP]

I note you saying that you "cannot change drive letters" but it would be in
your best interest to find a way. Ever since USB mass storage devices became
available some 8 (?) years ago, it has been common practice to use the high
letters of the alphabet for network drives so that the low letters remain
available for USB devices.

Until you have found a way to move your share drive letters out of the way,
here are three options:
a) Plug in your USB device, then assign a high drive letter. Windows will
remember the letter for this device.
b) Run a background VB Script based on WMI. Its purpose is to detect the
arrival of a USB device and assign a free drive letter to it. Post again if
you need more details on this technique.
c) Have a look at this link: http://www.uwe-sieber.de/usbdlm_e.html.


Hello,

we have some users that are not local admin in Windows XP SP2.

We have several network drives mappend on this computer when the user logon
(E drive to K). (I precise I cannot change those letters)

I know this KB
http://support.microsoft.com/default.aspx?scid=kb;en-us;297694 , and I have
installed the hotfix but it is not working in every situations.

Indeed, Windows XP remembers the letter assigned to the removable media the
first time we introduce it.

So, if the first time that I plug my USB key I am out of office (so with no
network drive mapped), the letter assigned will be the E drive; and then if
I go back to work and I plug again my USB key, the letter assigned will be
the E: (even with the hotfix installed) but the E: drive will already be
assigned to my network share.

Am I misunderstanding something ?

Do you know if there is any solution for that ? (as the helpdesk has quite a
lot of calls just because of this).

Thanks :)
 
E

Eric

Hi Pegasus,

thank you for your answer.

Actually in this company I cannot change the network drive letter but I
totally agree with you about the best practices but I know that we
cannot change the network drive path actually.

About the "A" option I cannot assign a high drive letter as the user
that will have to do so will not be a local admin, so... :)

About the "C" option, I already know this tool but as it is in a big
company, the solution has a "high cost" (sorry for my poor english ;p)

About the "B" option, do you confirm that this is the only solution and
that Microsoft doesnt have any solution for quite a common problem ?
If yes, i will be pleased to receive more information about the method
used !

Thanks
 
P

Pegasus [MVP]

Unfortunately the method based on WMI requires admin privileges to assign a
drive letter and is therefore unsuitable for your environment. About the big
company/big cost issue: The cost of the USBDLM solution per PC is less for
big companies than for small ones. If you still consider it excessive then
you must change the drive letters of your shares.

If you want to find out whether Microsoft (or anyone else) has an
alternative solution then I recommend that you repost your query in a server
and/or networking newsgroup. Remember to use cross-posting when posting in
more than one group - see here: Multi-posting:
http://www.blakjak.demon.co.uk/mul_crss.htm.
 
E

Eric

Thank you Pegasus.

So I ask for this question in another newsgroup to see if someone has
an answer :)
 
E

Eric

Most of them are using SP3.

Are you sure that the problem adressed in SP3 is the same as the
situation quoted here ?

Thank you !
 
P

Pegasus [MVP]

DaveMills said:
This USB Drive letter issue was addressed in SP3 what SP level are your
systems.

Was it? Try the following experiment on your SP3 machine:
1. Plug in a USB flash disk.
2. Note its drive letter. Let's assume it is X:.
3. Remove the flash disk.
4. Click Start / Run
5. Type the three lettres cmd
6. Click OK
7. Type the following commands:
xcopy %comspec% c:\Test\ {Enter}
net share Test=c:\test{Enter}
net use X: \\%ComputerName%\Test{Enter}
(Replace X: with the letter noted in 2. above)
8. Plug in your flash disk.
9. Use Windows Explorer to examin drive X:. You *should* see your flash disk
but you actually see the file cmd.exe, which is located in the Test share.
This is the OP's problem.
 
U

Uwe Sieber

When searching for the first available drive letter,
SP3 considers letters of present network drives
which SP2 did not.
But when a drive already hat a letter assigned then
there is no check against the network letters.

From http://www.uwe-sieber.de/usbtrouble_e.html
What the SP3 did not fix is this scenario: Letters C: + D:
used for local drives, E: for an USB drive. Remove the USB
drive, create a network drive at E: and reattach the the
USB drive again. XP with SP3 will assign E: anyway, the
USB drive is 'hidden'. This is fixed in Vista.


Uwe
 
P

Pegasus [MVP]

Uwe Sieber said:
When searching for the first available drive letter,
SP3 considers letters of present network drives
which SP2 did not.
But when a drive already hat a letter assigned then
there is no check against the network letters.

From http://www.uwe-sieber.de/usbtrouble_e.html
What the SP3 did not fix is this scenario: Letters C: + D:
used for local drives, E: for an USB drive. Remove the USB
drive, create a network drive at E: and reattach the the
USB drive again. XP with SP3 will assign E: anyway, the
USB drive is 'hidden'. This is fixed in Vista.


Uwe

Thanks for the clarification. I'm surprised that it took Microsoft such a
long time to fix this issue. On the other hand it created a nice niche
market for you!
 
E

Eric

Thank you for this info Uwe.

the SP3 seems to have the hotfix of the KB 297694 integrated.
And indeed, if a drive has already been inserted with a drive letter
used then by a network drive, it will be hidden.

So do you know if there is a solution for that ?(instead of using your
software =))

Do I have to delete some of the entries in the
HKLM\System\MountedDevices for example ?

Thank you
 
U

Uwe Sieber

Yes, deleting values with network drive letters under
HKLM\System\MountedDevices would remove the assignment.
On next arrival of the drive XP would search the first
available letter.
If the drive arrives before the network shares are
created, then the problem is back.


Uwe
 
D

DaveMills

Was it? Try the following experiment on your SP3 machine:

Well yes it was addressed but not fixed it seems. I have learned a bit more in
this thread. I can say that SP3 has greatly reduced the incidence of the issue
but now I know why the few that remain are happening.

The main issue I have had is where the USB drive letters get assigned before the
mapped drive gets set up. The Mapped drive cannot be changed (it would upset the
company standards). For this I use a WMI script to allocate a list of drive
letters that are allowed. The script moves the USB drives to the allowed list I
set.
 
E

Eric

And again for those who dont have the SP3 installed SP2 + hotfix 297694
do the same.

I am interested about your WMI script if you agree to send it to me.
Is it running as a service with a specific admin account ?

Thanks !
 
B

Bob I

In reality, if you let Windows assign letters automatically that
practice goes back at least twice that far! Windows assigns locals C up
and Remote/network Z down.
 
S

smlunatick

And again for those who dont have the SP3 installed SP2 + hotfix 297694
do the same.

I am interested about your WMI script if you agree to send it to me.
Is it running as a service with a specific admin account ?

Thanks !

Look at Uwe's USBDLM software. You can then "force" the USB flash
drives to higher drive letters, outside of your network map range.

http://www.uwe-sieber.de/usbdlm_e.html
 
D

DaveMills

I will need to get it from work. It runs as a startup script so under the system
account.
 
P

Pegasus [MVP]

Rather than sending the script to your private address, DaveMills should
post it here for the benefit of other people who have a similar problem.

Eric said:
Thank you I will appreciate.

Here is my mail : iautran[at]hotmail.com

Thanks !
I will need to get it from work. It runs as a startup script so under the
system account.
 
D

DaveMills

Sorry guys, I forgot about doing this
I have had this running for a couple of years as a startup script in the domain
for most desktop workstations. It uses MountVol.exe to actually change the drive
letter. The script just manages the process.

It was written when a new PCs were delivered that had 4 SD type drive which
pushed the use drives up to H: or I: which clashed with our network drives. I
needed to move these up to some other set of letters hence this script was born.

Warning there may be some line wrapping so watch out for that. Its just one of
the hazards of UseNet posts.

********************* Script follows ************************
'MapRemovableDrives.vbs Version 1.00.00
' ******************************************************************
' Copyright (c) 2008, D J Mills DJMills Consulting
' www.djmills.co.uk
' All rights reserved.
'
' Redistribution and use in source and binary forms, with or without
' modification, are permitted provided that the following conditions
' are met:
'
' * Redistributions of source code must retain the above copyright
' notice, this list of conditions and the following disclaimer.
' * Redistributions in binary form must reproduce the above
' copyright notice, this list of conditions and the following
' disclaimer in the documentation and/or other materials provided
' with the distribution.
'
' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
' "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
' LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
' FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
' COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
' INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
' BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
' LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
' CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
' LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
' ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
' POSSIBILITY OF SUCH DAMAGE.
' ******************************************************************
'
'Removable drives such and those for flash drives and cameras get assigned a
dive letter at system startup
'These often take over letters required for mapped network drives and cause the
mapping to fail.
'
'This script re-assigns these devices to a list of acceptable drive letters. It
does not re-assign drive A or B
'You must edit the line later in this code to set the list of drive letters to
use.
'
'There are some debug msgbox lines commented out and the last line if
uncommented will report what happened.
'Actions are logged to C:\Windows\MapRemovableDrives.log
'
Option Explicit
Dim strDrivesToUse 'List of drive letters that can be used as a
string e.g. "PQRST"
Dim strDrivesLeft 'List of drive letters left for use and is edited
as drives are allogated.
Dim strComputer 'Name of computer - Only tested "."
Dim strNewID 'Drive ID to assign
Dim strCmd
Dim objWMIService, objSh
Dim colDisks, colVolumes
Dim objDisk, objVolume
Dim strOutput
Dim strType
Dim intNewID
Dim objFSO
Dim objLogFile
Dim blnChanged 'Turns on the log if a change is made

Const ForAppending = 8
Const Drive_REMOVABLE = 2
Const Drive_FIXED = 3
Const Drive_NETWORK = 4
Const Drive_CDROM = 5 'can be a CD or a DVD
Const Drive_RAMDISK = 6
Const WINDOW_STYLE_HIDDEN = 1
Const WAIT_ON_RETURN = True
'
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
' Change the line below to the acceptable drive letters to use
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
strDrivesToUse = "RUVWY"
strComputer = "."
strOutput = ""
blnChanged = False

Set objSh = WScript.CreateObject("WScript.Shell")

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk")

strDrivesLeft = strDrivesToUse 'Init the list to allocate from

'First remove any drive IDs that are already being used from strDrivesLeft
'so that it will not try to assign an in use drive ID later
For Each objDisk in colDisks
intNewID = instr(strDrivesToUse,Left(objDisk.DeviceID,1))
If intNewID > 0 Then
strDrivesLeft = Replace(strDrivesLeft,Left(objDisk.DeviceID,1),"")
End If
Next

' msgbox strDrivesLeft

strOutput = strOutput & "ID: "& vbTab & "Drive Type" & vbCRLF 'Headings

'Now for eeach removable drive test to see if it is Legal, i.e. is in
strDrivesToUse
'If it is do nothing as it is not a conflict
'If it is not move it to one of still in strDrivesLeft
For Each objDisk in colDisks
Select Case objDisk.DriveType
Case 1
strType = "No root directory. Drive type could not be determined."
Case Drive_REMOVABLE 'Removable drive
Select Case objDisk.DeviceID
Case "A:", "B:" 'Ignore the floppies
strType = "Removable drive. '" & objDisk.DeviceID &"' not reset"
Case Else
'See if the current ID is in the list of acceptable drive letters
'If it is then simply remove it from tha acceptable list. If not then
reallocate it
' msgbox strDrivesToUse & " " & objDisk.DeviceID & " " &
Left(objDisk.DeviceID,1)
intNewID = instr(strDrivesToUse,Left(objDisk.DeviceID,1))
' msgbox intNewID
If intNewID = 0 then
strNewID = left(strDrivesLeft,1) & ":"
strDrivesLeft = Mid(strDrivesLeft,2)

strCmd = "%ComSpec% /C FOR /F %V IN (" _
& "'mountvol.exe " & objDisk.DeviceID & " /L'" _
& ") DO (" _
& "mountvol.exe " & objDisk.DeviceID & " /D & " _
& "mountvol.exe " & strNewID & " %V)"
' msgbox strcmd
blnChanged = True
objSh.Run strCmd, WINDOW_STYLE_HIDDEN, WAIT_ON_RETURN
strType = "Removable drive. Reset from '" & objDisk.DeviceID & "' to
'" & strNewID & "'"
Else
strType = "Removable drive. '" & objDisk.DeviceID &"' not reset"
End if
End Select
Case Drive_FIXED
strType = "Local hard disk."
Case Drive_NETWORK
strType = "Network disk."
Case Drive_CDROM
strType = "Compact disk."
Case Drive_RAMDISK
strType = "RAM disk."
Case Else
strType = "Could not be determined."
End Select
strOutput = strOutput & objDisk.DeviceID & vbTab & strType & vbCRLF
Next
'Log the chages made

If blnChanged Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.OpenTextFile("C:\windows\MapRemovableDrives.log",
ForAppending, True)
objLogFile.Write vbCRLF & Now() & vbCRLF & strOutput
objLogFile.Close
End If

set objFSO = Nothing
set objLogFile = Nothing
set objSh = Nothing
set objWMIService = Nothing
set colDisks = Nothing

' Wscript.Echo strOutput

****************************Script ends*************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top