Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Drive letter assignments change after Sysprep

177 views
Skip to first unread message

Phil Combs

unread,
Aug 23, 2002, 4:13:35 PM8/23/02
to
I'm setting up a model PC for ghosting to a number of
similarly-configured PCs. In the setup, I've assigned the
CD-ROM drive a letter of N:. However, after running
Sysprep, making my image, and blasting it out, I noticed
that Sysprep/XP changes the CD drive letter to E: (the
next available letter).

How do I stop this annoying behavior?

Torgeir Bakken

unread,
Aug 23, 2002, 8:07:51 PM8/23/02
to
Phil Combs wrote:

Hi

I don't know, but if you do not find asolution, I have created a VBScript that
uses the WMI StdRegProv class to rename driveletters in registry. I guess you
can get sysprep to run program at exit or something (or put it in RunOnce in
registry)?

In that case, use
cscript.exe <path to vbs file>

or if you want to supress any messages (the WScript.Echo part)
cscript.exe //b <path to vbs file>


StdRegProv
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/stdregprov.asp


Put the following in a .vbs file:


' Script that changes drive letters
' Note: Do NOT use it on SYSTEM or BOOT partition drive letters !!!
' Author: Torgeir Bakken

sComputer = "."
Const HKLM = &H80000002

' from/to
If ChangeDrvLetter("E:", "N:") Then
WScript.Echo "Drive letters changed, please reboot to see the change!"
Else
WScript.Echo "Failed changing drive letters!"
End If


Function ChangeDrvLetter(sSourceDrive, sTargetDrive)
bOK = True ' Init value
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& sComputer & "\root\default:StdRegProv")

sKeyPath = "SYSTEM\MountedDevices"
sSrc = "\DosDevices\" & UCase(sSourceDrive)

iRC = oReg.GetBinaryValue(HKLM, sKeyPath, sSrc, sValue)

If iRC = 0 Then
sTrg = "\DosDevices\" & UCase(sTargetDrive)

iRC = oReg.SetBinaryValue(HKLM, sKeyPath, sTrg, sValue)

If iRC = 0 Then
oReg.DeleteValue HKLM, sKeyPath, sSrc
Else
bOK = False
End If
Else
bOK = False
End If
ChangeDrvLetter = bOK
End Function

--
torgeir


Phil Combs

unread,
Aug 26, 2002, 6:09:11 PM8/26/02
to
I appreciate the answer, but I was hoping for something a
little simpler, like a registry tweak...

>.
>

0 new messages