Excellent idea
lucdesaulniers, however, I took it a little further. To ensure that adding or changing devices doesn't mess with the volume numbers, I wrote a script that makes sure a specific Device ID gets a specific Drive Letter. If the Drive letter is not correct, it writes the diskpart script, executes diskpart, then deletes the file it just created, and goes on to the next drive. Here it is:
=====Script Start=====
On Error Resume Next
'Device IDs
DeviceID_V = ""
DeviceID_W = ""
DeviceID_X = ""
DeviceID_Y = ""
DeviceID_Z = ""
strComputer = "."
Dim nRtn, WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive")
For Each objItem in colItems
Select Case (objItem.DeviceID)
Case DeviceID_V
x = ChgDrv ("V:", objItem.Drive)
Case DeviceID_W
x = ChgDrv ("W:", objItem.Drive)
Case DeviceID_X
x = ChgDrv ("X:", objItem.Drive)
Case DeviceID_Y
x = ChgDrv ("Y:", objItem.Drive)
Case DeviceID_Z
x = ChgDrv ("Z:", objItem.Drive)
End Select
Next
Function ChgDrv(Drive, theDrive)
wscript.echo theDrive & " => " & Drive
If theDrive <> Drive Then
'Create File
strFilename = "C:\Scripts\cdrom\chgdrv" & Left(Drive,1) & ".txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(strFilename)
objFile.Close
'Write Data to File
Set objFile = objFSO.OpenTextFile (strFilename, 2)
objFile.WriteLine "select volume " & theDrive
objFile.WriteLine "assign letter=" & Drive
objFile.WriteLine "exit"
objFile.Close
'Run Diskpart calling the script just created
strRun = "diskpart /s " & strFilename
nRtn = wshShell.Run(strRun, 2 , True)
'Delete File
objFSO.DeleteFile(strFilename)
End If
End Function
=====Script End=====
Don't forget to insert your Device IDs.