Windows Installer using usb drive for temp purposes

When installing apps that are built around Windows Installer, it would appear that it often uses my external usb hard disk (when it’s connected) as the temp location while it expands and installs the application (creates a folder off the root with a guid name).  Is there anyway to change this so it always defaults to a specific drive?

This appears to be the case on Windows Vista and 7, not sure about previous releases.

EDIT: Current environment variables look like this:

TEMP=C:Users<me>AppDataLocalTempTMP=C:Users<me>AppDataLocalTemp

EDIT: I have a funny suspicion that it’s using the drive with the largest available free space.

Solution:

I believe that the Windows Installer uses the %TMP% environment variable. You may want to check this value and see if it happens to be pointing to your External HD drive letter.

UPDATE

Weird… this does seem to be a “feature” of Windows Installer (to use the drive with the most free space). I can’t find an option to disable it. I wonder if you can lock the system out by permissions/read-only flag or something similar. It bugs me that Microsoft wouldn’t give you an option to turn this off.

2nd UPDATE

Ok — so I found this article about the ROOTDRIVE property. Of particular note:

 

If ROOTDRIVE is not set at a command  line or authored into the Property  table, the installer sets this  property. During an administrative  installation the installer sets  ROOTDRIVE to the first connected  network drive it finds that can be  written to. If it is not an  administrative installation, or if the  installer can find no network drives,  the installer sets ROOTDRIVE to the  local drive that can be written to  having the most free space.