Configuration

USBDLM

 

Configuration


 

The desired drive letters or mount points and other settings are defined in a text file called USBDLM.INI located in the same place as the USBDLM.EXE.

Modern applications often store their settings in the Windows registry but I don't like that. INI files are the 'classic' approach. 

 

Windows Vista, Windows 7, 8, 8.1, 10, Server 2008 (R2), 2012:

Since Windows Vista the "Virtual Store" might redirect the INI file to

C:\Users\(UserName)\AppData\Local\VirtualStore\Program Files\USBDLM

when you modify or copy it.

But the USBDLM service always reads from its own folder. So, since Vista always edit the INI file as "real" Administrator, this is what the _edit-ini.cmd file performs.

Or install USBDLM into a different folder, for instance to C:\Tools\USBDLM because the Vista Virtual Store deals with the "C:\Program Files" folder only.

 

I suggest to open the INI by means of the _edit-ini.cmd because it requests the required admin privileges.

 

_edit-ini.cmd also creates a small USBDLM.INI if there is none present yet.

 

Unicode:

If you need Unicode then save the INI file as such, it must be Little Endian, with byte order mark FFFE, the Windows Editor (notepad) can do correctly.

 

 

How INI files work:

INI files have sections leaded in by names in square brackets, e.g. [DriveLetters] or [BalloonTips]. The settings relevant to that section appear below the section name.

 

Comment lines begin with a semicolon. Never try to deactivate a section this way:

 

;[DriveLetters]

Letters=X,Y,Z

 

This extends the previous section to the begin of the next section which leads to unexpected results. Either comment-out all lines of the section or just invalidate the section name like so:

 

[xxxx DriveLetters]

 

It is still a new section but with no effect because of the unknown name.

 

In regular INI files each section name must be unique, same for values within a section. With USBDLM V5.0 this rule is no more. You can have the same section name many times, the priority of unnumbered sections is defined by order of appearence.

But this is the case only for sections with criterions as DriveLetters, OnArrival, OnBalloonClick etc, but not for Settings, BalloonTips etc.

 

 

Settings in the Registry:

Since V3.3.1 USBDLM can read its settings from the registry too. It reads from

HKLM/Software/Uwe Sieber/USBDLM

 

If this registry key exists, then the USBDLM.INI is ignored! Only the log file settings are read from the INI then.

 

To make USBDLM see changes in the registry, change the (Standard) value under HKLM/Software/Uwe Sieber/USBDLM to any different value than before. USBDLM reads the configuration again then.

Here is a sample REG file (do not execute it unchanged): http://www.uwe-sieber.de/files/usbdlm_sample.reg

 

Under x64 Windows the Win32 edition of USBDLM is redirected to

HKLM/Software/Wow6432Node/Uwe Sieber/USBDLM

so better use the x64 version here.

 

 

Simple Samples

 

Without a configuration USBDLM solves conflicts between USB drives and network or subst drives.

 

USBDLM offers several ways to control the drive letter assignments. For each definition there is a section in the USBDLM.INI with up to 9 drive letter lines.

The value numbers have no relation to anything. The values are just evaluated from low numbers upwards to high numbers.

 

 

Most simple sample that works for USB flash drives and USB harddrives:

 

Before USBDLM V5.0 with numbered values:

 

[DriveLetters]

Letter1=U

Letter2=V

Letter3=W

.

.

Letter9=X

 

 

Since USBDLM V5.0 without numbers:

 

[DriveLetters]

Letter=U

Letter=V

Letter=W

.

.

Letter=X

 

 

Each letter is checked then and the drive will be remounted to the first one that is available.

 

 

Since V4.1 you can use a short notation. This works for drive letters only, not for NTFS mount points!

Samples:

 

[DriveLetters]

Letters=A,W,X,Y,Z

 

You can use ranges too:

 

; W-Z is expanded to W,X,Y,Z

[DriveLetters]

Letters=A,W-Z

 

; Z-W is expanded to Z,Y,X,W

[DriveLetters]

Letters=A,Z-W

 

And you can omit the comma:

 

[DriveLetters]

Letters=AWXYZ

 

Since V4.3.2 Letter, Letters, Letter1 to Letter9 are all handled equal, so you can even write Letter1=AWXYZ.

 

 

By default USBDLM assigns one mountpoint only. Since V4.3 multiple NTFS mountpoints can be assigned, also in addition to a drive letter.

 

Sample for letter U: or V: and two additional NTFS folders:

 

[DriveLetters]

MaxMountPoints=3

Letter1=U

Letter2=V

Letter3=C:\_USB\%DevName%

Letter4=C:\_Share\Drive_%DriveLetter%

 

Windows does not allow to assign more than one letter as mountpoint.

 

 

 

Priority

 

First "Letters" is read, then "Letter" and Letter1 to Letter9. Since V5.0 then up to 9 additional Letter lines.

 

 

No letter / remove the drive

 

To hide a drive (remove it's drive letter) configure a single minus char:

 

Letter=-

 

 

To remove a drive (prepare it for safe removal) configure two minus chars:

 

Letter=--

 

 

To get partition number 1 on a USB disk at X: and hide partition 2:

 

[DriveLetters]

Letter=X

Letter=-

 

But it works only if X: is available. Otherwise all partitions get no letter.

 

 

To hide partition number 1 on a USB disk and get partition 2 at X:, this will not work:

 

[DriveLetters]

Letter=-

Letter=X

 

Why? For each drive the configured letters are checked and the first available one is used. "No letter" is always available, so the second Letter line is never reached. The drive letter of each partition is removed.

Use Drive Letters by Partition Number in this case.

 

 

Drive letters depending on certain criteria

 

To apply a section to certain drives only, you can define criteria in this section. If you use multiple then since V5.0 there is no more need for numbering. It still works but is no more required.

The sections are tested from [DriveLetters1] to [DriveLetters99] and finally 100 sections [DriveLetters] (without a number) in order of appearance.

So, configure special cases first and more general ones towards the end.

 

USBDLM uses the drive letters from the first section that fits only. There is no fallback to another section if all configured drive letters in a section are in use!

 

 

Sample to lock drives above 10 GB and get smaller drives at U, V and W:

 

;remove the drive letter for drives larger than 10GB

[DriveLetters]

MinDriveSize=10GB

Letter=-

 

;all others at U, V, W

[DriveLetters]

Letter=U

Letter=V

Letter=W

 

or in short notation:

 

[DriveLetters]

Letters=U,V,W

 

 

There is a detailed description under Drive letters depending on certain criterions.

 

 

General Settings

 

 

 

Mounting to NTFS folders

 

Instead or in addition to letters you can set up empty folders on NTFS drives as mount points too, see Mounting to NTFS folders