Drive Letters depending on Criteria
Since V4.0 you have complete freedom of using many different criteria.
You need then several sections [DriveLettersX], in which the different criteria are defined together with the target drive letters.
The sections are tested from [DriveLetters1] to [DriveLetters99] and finally under USBDLM V4 one [DriveLetters] and up to 100 [DriveLetters] since USBDLM V5. So you can still use numbered section as with USBDLM V4 or omit the section numbers.
The first section whose criteria fits to the drive is used. So, configure special cases first (or at low numbers) and more general ones later (or at higher numbers) and the most general last.
This works the same way for autorun events by means of sections [OnArrival], [OnRemoval], etc.
UsbDriveInfo is analyzing the USBDLM.INI from the folder of the USBDLM.EXE which is registered as a service. If this is not the current folder then it shows a warning. It shows for each drive copy&paste ready criteria lines and which section is used for them (press F5 after you changed the INI), so you can easily check if you have configured right.
This is (shortened) what UsbDriveShows for each drive:
========== Storage Volume on Disk 1 in Partition 1 ===========
MountPoint = Z:\
Volume Label = King16Back
Volume Size = 15.6 GB / 14.6 GiB / 15.619.129.344 Bytes
Volume Name = \\?\Volume{09247b47-82df-11e4-b297-001d729ad2b2}\
DeviceID = STORAGE\VOLUME\_??_USBSTOR#DISK&VEN_KINGSTON&PROD_DATATRAVELER_111&REV_PMAP#...
DeviceID Drive = USBSTOR\DISK&VEN_KINGSTON&PROD_DATATRAVELER_111&REV_PMAP\001CC0C60DBDBCC0C000010B&0
DeviceID Ctrl = USB\VID_0951&PID_1693\001CC0C60DBDBCC0C000010B
INI Sections = [DriveLetters]:33, [OnArrival]:38
---------------- 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
BusType=USB
PartitionNumber=1
DiskSignature=C3072E18
"INI Sections" shows which sections are used for a volume, for instance [DriveLetters]:33 means section [DriveLetters] in line 33.
Default criteria are:
BusType=USB
and
DriveTypes=REMOVABLE,FIXED
This means that a section without criteria fits for all USB drives but not USB floppy drives and USB CDROM drives.
If a different BusType or DriveType is used, then the default value is not used anymore.
Untypical sample for showing how it works, criteria in green, target letters in violet:
For USBDLM V4 or V5:
[DriveLetters]
DeviceID1=USB\VID_067B&PID_2517
DeviceID2=USB\VID_1234&PID_5678
Letter1=X
Letter2=Y
For USBDLM V5 with unnumbered values:
[DriveLetters]
DeviceID=USB\VID_067B&PID_2517
DeviceID=USB\VID_1234&PID_5678
Letter=X
Letter=Y
This section is used if a drive with either DeviceID USB\VID_067B&PID_2517 or USB\VID_1234&PID_5678 is attached. The drive then gets assigned X: if available, otherwise Y:. If both are in use then the first free letter is assigned. If in this situation no letter shall be assigned an additional Letter=- can be configured.
There is no relation between the numbers!
Typical sample for getting these two drives on their own letters:
[DriveLetters]
DeviceID=USB\VID_067B&PID_2517
Letter=X
[DriveLetters]
DeviceID=USB\VID_1234&PID_5678
Letter=Y
If you want two drives handled by one section then use the same criteria two times:
[DriveLetters]
DeviceID=USB\VID_067B&PID_2517
DeviceID=USB\VID_1212&PID_8976
Letter=X
Here one of the device IDs must fit the drive.
More samples:
1. FireWire drives at F, USB drives above 10GB at U, all other USB drives at W or Z:
;FireWire at F:
[DriveLetters]
BusType=FireWire
Letter=F
;USB >10GB at U:
[DriveLetters]
MinDriveSize=10GB
Letter=U
;all other USB drives at W: or Z:
[DriveLetters]
Letter=W
Letter=Z
2. USB multislot cardreader at L, M, N, O; all other USB drives at W or Z:
;MultiSlotCardReader at L:, M:, N: and O:
[DriveLetters]
DeviceType=MSCR
Letters=L,M,N,O
;all other USB drives at W: or Z:
[DriveLetters]
Letters=W,Z
Multiple criteria of the same type can be used, then one of them must match.
If multiple types of criteria are used, one of each type must match.
Sample for USB and FireWire drives above 10GB at F:
[DriveLetters]
BusType=USB
BusType=FireWire
MinDriveSize=10GB
Letter=F
Sample for a CF-Card in a PCMCIA slot at P:
[DriveLetters]
BusType=ATA
DeviceID=PCI\VEN_1217&DEV_7135
Letter=P
The real device ID is shown by UsbDriveInfo.
This way it does not work:
[DriveLetters]
DriveType=fixed
Letters=K,L
;special USB hard drive at I:
[DriveLetters]
DriveType=fixed
DeviceID=USBSTOR\DISK&VEN_WDC_WD20&PROD_00BB-00GUA0
Letters=I
Why? The first section 'catches' all USB harddrives, the section after is never reached.
So, always configure from special cases upwards to the general cases.
All the criteria are described in detail in the following sections.
Here is a list of all supported Criteria:
- MinVolumeSize Minimum size of the volume
- MaxVolumeSize Maximum size of the volume
- MinDriveSize Minimum size of the whole drive
- MaxDriveSize Maximum size of the whole drive
- DeviceID Device ID of the volume, the drive or its "Friendly Name"
- PortName Name of the USB port, e.g. 3-1
- VolumeLabel (*) Volume Label (also called Drive Name)
- VolumeSerial Serial number of the volume, e.g. 1234-A56E
- DriveType e.g. REMOVABLE, FIXED, CDROM, FLOPPY, RAMDISK
- DeviceType e.g. MSCR, TrueCrypt, BitLocker
- BusType e.g. USB, FireWire, ATA, ATAPI, SCSI
- PartitionNumber Partition number
- FileExists presence of a file or folder
- FileNotExists Absense of a file or folder
- DirExists presence of a folder
- DirNotExists Absense of a folder
- UserName User name of the logged on user
- UserGroup Group name of the logged on user
- UserIsAdmin 1 if user is an admin, 0 otherwise
- ComputerName Computer name, e.g. for a unique USBDLM.INI but different behaviour
- ProcessIsRunning A certain process is running
- ProcessIsNotRunning A certain process is not running
- MinOsVer / MaxOsVer Min or max version of the operating system
(*) May cause slower arrivals because the file system must be mounted. Therefore, if possible, put sections using such criteria to high section numbers. Sample:
Bad: Even for the drive with device ID USB\VID_9876&PID_5432 the volume label is checked and therefore the file system mounted before USBDLM knows the desired drive letter:
[DriveLetters]
VolumeLabel=Backup1
Letter=U
[DriveLetters]
DeviceID=USB\VID_9876&PID_5432
Letter=X
Good: For the drive with device ID USB\VID_9876&PID_5432 the volume label is not checked and therefore the file system is not mounted before USBDLM can change the drive letter.
[DriveLetters]
DeviceID=USB\VID_9876&PID_5432
Letter=X
[DriveLetters]
VolumeLabel=Backup1
Letter=U
Hint: Fictitious criteria do not work.
Another batch of criteria is related to the time, see Letters by Time.