Letters by Device ID
When a device ID is configured in a section then there is no need to configure a BusType or DriveType because a device ID is definite enough.
The device ID is a bit hard to configure...
Sample for two special drives at U and another special one at X:
[DriveLetters]
DeviceID=USB\VID_067B&PID_2517
DeviceID=USB\VID_1234&PID_5678
Letter=U
[DriveLetters]
DeviceID=USB\VID_9876&PID_5432
Letter=X
The "Friendly Name" as shown by the UsbDriveInfo tool can be used too but the configured name must contain a space. Otherwise the "Friendly Name" might not be determined. Furthermore determining the friendly name sometimes fails, using a real device ID is more reliable.
[DriveLetters]
DeviceID=Corsair Flash Voyager
Letter=V
Sample for a SD reader in a laptop with BusType SCSI:
[DriveLetters]
DeviceID=PCI\VEN_1217&DEV_7120
BusType=SCSI
Letters=F,G
The BusType can be omitted here since V4.3 because a DeviceID is defined which is definite enough.
You can determine the device ID by means of the UsbDriveInfo tool.
As Device-ID you can use the DevID of the drive or of its controller or its "Friendly Name".
For USB drives the controller is the USB controller chip.
UsbDriveInfo shows the criteria ready for copy and paste to the INI:
---------------- USBDLM Criteria -------------------
MinVolumeSize=14G
MaxVolumeSize=16G
MinDriveSize=14G
MaxDriveSize=16G
DeviceID=USBSTOR\DISK&VEN_KINGSTON&PROD_DATATRAVELER_111&REV_PMAP\001CC0C60DBDBCC0C000010B&0
DeviceID=USB\VID_0951&PID_1693\001CC0C60DBDBCC0C000010B
DeviceID=Kingston DataTraveler 111 USB Device
PortName=6-3
PortName=PCI\VEN_8086&DEV_283A&SUBSYS_20AB17AA&REV_03\3&21436425&0&D7-3
VolumeLabel=King16Back
VolumeSerial=A4605DC1
DriveType=REMOVABLE
DeviceType=DiskReadOK
BusType=USB
PartitionNumber=1
DiskSignature=C3072E18
An at least 8 characters long part from start is enough. Or use Wildcards.
If you deal with a large number of drives then you can use an external file with the device IDs. This saves the numbering.
[DriveLetters]
DeviceIDs=C:\USBDLM_DeviceIDs.txt
Letter1=V
In the text file there is just one device ID per line. Comments are lead in by a semicolon, empty lines are allowed.
Sample:
;admin's drives
USB\VID_067B&PID_2517
USB\VID_1234&PID_56789
;chef's drives
USB\VID_9876&PID_5432
USB\VID_4567&PID_4321
;others
USB\VID_3456&PID_3543
USB\VID_3456&PID_1432
The string compare is done case insensitive. The whole configured string must be found in the drives device ID to give a match.
Using the USB hardware serial number
Windows puts the serial behind vendor and product ID in the string. In the sample above the USB controller's device ID was
"USB\VID_0951&PID_1693\001CC0C60DBDBCC0C000010B".
The USB hardware serial number is 001CC0C60DBDBCC0C000010B.
Meanwhile pretty rare, there are devices without a hardware serial number, here Windows generates one, in this case it contains at least two & chars. Windows sees such devices a new on every different USB port.
To make the device ID match the device on any USB port, just omit the last part like so:
DeviceID=USB\VID_0951&PID_1693
This also makes it fit for multiple samples of the USB drive model with unique serials.
For devices with serial you can use the whole device ID or just the serial because it appears in the device ID strings.
[DriveLetters]
DeviceID=001CC0C60DBDBCC0C000010B
Letter=V
If you configure then Letter1=-- for all other USB drives in a higher section or section [DriveLetters] then you have the one and only functional USB drive.
If USB floppy and CD drives shall be blocked too then:
[DriveLetters]
DriveType=floppy
DriveType=cdrom
DriveType=removable
DriveType=fixed
Letter=--
Or short:
[DriveLetters]
DriveTypes=floppy,cdrom,removable,fixed
Letter=--
Or even shorter:
[DriveLetters]
DriveType=any
Letter=--