Preventing removal of a file or registry key during uninstall

Article:HOWTO9188  |  Created: 2005-10-04  |  Updated: 2007-05-29  |  Article URL
Article Type
How To

How do I prevent Windows Installer from removing a file (or registry key) on uninstall?


By default, Windows Installer uninstalls all files that are installed during the initial install. Preventing the removal of an installed file can be done at the component level, but not at the file level. There are two different ways to accomplish this either by modifying the Component table directly, or modifying the Component details.

To modify the Component table, follow these steps:

  1. Select the Component table from the Tables tab in Setup Editor, and highlight the Attributes column of the component that is to be left on the machine during the uninstall.
  2. Change the value in the Attributes column to 16 for the component to keep during the uninstall. Press the <Tab> key to update the field.

To modify the Component Details, follow these steps:

  1. Determine which component contains the file in question; go to the Setup Editor and click on the Components tab.
  2. Locate the appropriate component, right-click on it, and select Details.
  3. In the Component Details dialog, mark the "Leave installed on uninstall" checkbox.

Both of these approaches will leave the entire contents of a component installed after an uninstall. To leave just a single file installed after uninstall, you may need to create a new component (which would contain only the file in question) and follow the steps above to flag it as permanent.

Legacy ID


Article URL

Terms of use for this information are found in Legal Notices