Starting an administrative/elevated program on bootup under Vista

This is for all you Vista users who are tired of manually launching every time you reboot: Here is how to set a program which requires elevation to start automatically in Windows Vista without prompting for elevation.

  1. Control Panel -> Administrative Tools -> Task Scheduler
  2. In the right pane, click “Create Basic Task”
  3. Enter a name for the task (can be anything), then click Next
  4. Select “When I Log On” then click Next
  5. Leave “Start a Program” checked and click Next
  6. In the Program field enter the name of the EXE and optional arguments, then click Next
  7. Check the box “Open the Properties dialog…”, then click Finish
  8. Check the “Run with highest privileges” box, click OK.

You are done. Next time you reboot, your app will start automatically after logon.

Easy, huh?

USB drive letters won’t stay put?

The problem: In Windows, USB drives are assigned letters when they are connected. When you disconnect and reconnect a drive, there is no guarantee that the server will be assigned the same letter, especially if you’ve rebooted, or changed other USB drive configuration.

Worse, if you have network drive letters (which live in user space), the system will sometimes assign conflicting USB drive letters (which live in system space)

The solution, at least in XP and Vista, is six magic letters: USBDLM.

From the website, “USBDLM is a Windows service that gives control over Window’s drive letter assingment for USB drives.”

Now, that being said, it has the feel of being made by, and for, programmers. You will need to edit text files to get this working, installation is via a command line script not an installer, etc.

It’s not that hard once you master the concepts, but there is a steep learning curve to use the advanced features.

Lets see if we can’t simplify a bit, just to get you started.

Step 1) Download USBDLM

Step 2) Unzip into an appropriate location.  I’d recommend “C:\Program Files\USBDLM”

This location should not be within your profile (not the C:\Documents and Settings\ directory in XP, or the C:\Users\ directory in Vista)

3) Rename the “USBDLM_sample.ini” file to “USBDLM.ini”

4) Open USBDLM.ini in notepad (Just double click it, in most cases Windows will know what to do)

Look for the “[DriveLetters]” section, enter the following settings to have USB drives use “X” “Y” and “Z”

[DriveLetters]
Letter1=X
Letter2=Y
Letter3=Z

You can add more “Letter#” lines, up to a total of 9.  They count up from one and if you either miss or duplicate a line, USBDLM will stop reading.

There are *lots* of other configuration options available, I can show you a few interesting ones if you’re not too overwhelmed yet, see the “Advanced” section.

5) Install it by running the _install.cmd script.

Note that you must be an administrator, and if you’re using Vista, right click and use the “Run as administrator”, this installer will not prompt to be elevated.

*whew*  That wasn’t so bad, was it
As soon as the install finishes, any existing USB drives should be reassigned to appropriate drive letters.

Most users can stop reading here.  If it works, and you’re happy, smile, nod, act proud, and never speak of it again.

Since you’re still reading, one quick tip: If you want to change configuration options after installing, just edit the usbdlm.ini file.  When you want to “apply” the changes, go to the start menu, choose run, and type “services.msc”, in the list find “USBDLM” and click the “restart” button in the toolbar (it looks like a square, with a play button)

Now, advanced users only, keep reading, there are some other fun settings that can make your drive letter mess a little more friendly.

(Note that you can actually render your system unbootable — If you screw up the settings badly enough, you can cause USBDLM to actually try to unmount your system drive.  This isn’t easy, but it can be done)
First off, I really like [Settings]’s “NoMediaNoLetter=1” option — This means for a card reader, the drive letter will disappear entirely when you don’t have a card inserted.  This is fantastic if you own a multi-slot card reader and have four drive letters used up that you rarely use.  As soon as you insert a disk (media card, whatever) the drive letter will be assigned.

Second, you can use ranges of drive letters like this:

[DriveLetters]
Letters=A,W-Z
(Note that it’s called “Letters” instead of “Letters1” — Read the documentation for all the details, but the above example will work, and you can tweak without risk)

Next up, you can use multiple [DriverLetters] sections, like this:

[DriveLetters]
Letters=W-Z

[DriveLetters1]
MinDiskSize=10GB
Letter=RSTUV

This would assign any disk larger then 10GB to “RSTUV” while smaller USB drives get assigned to “WXYZ” — Unless you have any other drives that are 2TB in size, this is the easiest way to force drobo to one letter, and let other USB drives sort it out amongst themselves.

If you want to get more advanced, read the full help file at http://www.uwe-sieber.de/usbdlm_help_e.html — This tool is extremely powerful, you can force all sorts of different types of drives to different letters, or even assign letters by drive serial number, interface, size, media type, or any combination.

Success stories welcome, or share your pain — I’ve lost a bit of hair trying to get this working, sometimes you just need a second pair of eyes in the advanced stuff.