16

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>\AppData\Local\Temp
TMP=C:\Users\<me>\AppData\Local\Temp

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

3
  • I don't know if there is a way to change it or not, but I'll tell you why this happens. It uses the drive which has more free space to output the temporary directory with the files and as you say, its name will be unique.
    – Xandy
    Nov 16, 2009 at 19:26
  • 2
    I believe you're on to something with the "using the largest available free space" edit. My experience is totally anecdotal, but I added a terabyte HDD to my Windows 7 box shortly after I installed the OS. The very next day it ran Windows updates. I hadn't put any files on the new drive yet and after the reboot I found a bunch of temp files stashed there. Nov 16, 2009 at 19:58
  • Windows is such a NONSENSE SO! OMG... my usb drive wakes up because WINDOWS INSTALLER wants to create a TEMP folder on it!!!
    – marcolopes
    Jun 1, 2021 at 9:31

2 Answers 2

16

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.

5
  • I don't think so. My %TEMP% and %TMP% variables point to my C: drive and the installers often copy files to my R: drive.
    – Snark
    Nov 16, 2009 at 19:20
  • TEMP and TMP are set to: C:\Users\<me>\AppData\Local\Temp Nov 16, 2009 at 19:21
  • 1
    I bumped into similar situation. Not sure what the remedy is.
    – Vivek
    Jul 21, 2012 at 22:46
  • I understand that if the ROOTDRIVE property is not set, the temporary files go to the disk with the hugest amount of free space. But the more interesting question is why are these temporary(!) files not automatically removed when the installation finished?
    – Erik
    Nov 14, 2018 at 10:04
  • 1
    Is the ROOTDRIVE property something we can set system-wide (like environment variables)? If so, where do we set this? (I'm sick of installations failing because they try to throw temporary files on my locked down external drive.) Mar 31, 2020 at 22:48
3

I had this problem with an external HDD that was used exclusively for personal photos and home video. I disabled 'delete' permissions for all users to prevent any data being lost. However, the drive began to fill up with MSI tmp files. Any automated removal was refused as was any cleaning tool because (as I mentioned) I had refused delete permissions. My solution was to turn off all permissions on the target drive for all users (with the exception of 'write' priviliges for one user), preventing the OS from writing to the drive in the first place. Hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .