Login to participate
Endpoint Management & Virtualization BlogsRSS

Removing Files that Remain After Un-Installation

R-Vijay's picture

If a file that should have been removed from the user's computer remains installed after running an uninstall, the installer may not be removing the component containing the file for one or more of the following reasons:

  • The msidbComponentAttributesPermanent bit was set for the component in the Attributes column of the Component table.
  • No value was entered for the component in the ComponentId column of the Component table.
  • The component is used by another application or feature that is still installed.
  • The key file for the component has a previous reference count under HKLM\Software\Microsoft\Windows\CurrentVersion\SharedDlls.
  • The component is installed in the System folder and any file in the component has a previous reference count under HKLM\Software\Microsoft\Windows\CurrentVersion\SharedDlls.

The installer does not remove any files that are on the Windows File Protection (WFP) list. If a component's key file is on the WFP list of protected files, the installer does not remove the component.

jdulle's picture

Also files that were

Also files that were created by the application not by the application install. If you want to remove these files on uninstall you will probably need to include a custom action to delete them on uninstall.

R-Vijay's picture

Yeah.. True.!!

Yeah.... True !!!

MSI is just metadata. the data which are in a MSI will be created on installation and removed during un-installation. whenever, a file is left back, it may be a junk file or a runtime file.
SOmething like a log file(which contains information on application lauch etc..), the runtime tmp file etc...

In this case, as jdulle suggests we will need to create a custom action using VBscript or Wisescript to remove these files on un-installation. If the file name remains same on various un-installation tests. then this file can also be entered in the remove file entry in WPS.

Microsoft MVP [Setup-Deploy]
Weblog: www.msigeek.com

Harsh's picture

It's not only runtime or user generated data.

Hi Vijay,
Sorry but would like to understand what exactly you mean by metadata.
Just like to correct you that MSI is not Metadata, its database holding tuples. and these tuples contains data. Every tuple or record is refrentially integrated.

You are perfectly right with stating MSI is resposnible to install and unsinatll the data which formed under its record.

I like to add that there are some files which get held by application processes (can be seen in task manager).So these process won't allow you to uninstall some files. So you can write custom action to kill these processes. Then possibly your uninstalltion will be clean.

You dont need to use cutom action to delete the files which are generated at runtime.
If you know the system and aware of names of files which do get generated at the runtime you can use REMOVE FILE table of MSI.

Thanks.
Harsh

vijayksuvarna's picture

Some more info.

Yes, discussion seems to be going good. So thought I will put a summary...

Actually MSI won't be able to remove the following:
1. Run time files\Registries:
These are the files and registries that created during the usage of the application. So the MSI won't have any knowledge on these resources. So we have to handle this by adding a Remove table (may be a file or registry or ini) or need to write a script to delete it.

2. File in Use:
MSI won't be able to remove the files which are in use. Example a service file if it is in start mode. So we need to take necessary step to either stop this service or write a task kill(general case) option to kill the process which is running. This action should be written just above remove file standard action.

Vijay Kumar
~~~~Problem is something which is having a solution~~~~

Vijay Kumar
~~~~Problem is something which is having a solution~~~~

Harsh's picture

Remove Registry table

Summary is ok, but would like to make one correction.
Removeregistry table is used at the time of installation sequences.
It can not be used at the time of uninstallation.
So if you want to remove registry which are generated at the runtime you can only remove it using script or you can add that registry in the MSI registry table so it will get remove at the time of un-installation.

Remove Registry Table can only be used when you want to uninstall registry at the time of installation sequence only.

amit_salekar's picture

Files remaining after Un-installation

Clean uninstallation means ur package must uninstall\remove all the file and registries which are from ur package and which are generated runtime.
1) Check any file remaining after uninstallation regardless weather its from ur package or its generated runtime. For that try maximum shortcut for maximum functionality.
2) Try to delete that files manually if its deleting file manually without promting any error then u can safly add those entries into remove file table.
3) still any file remains in any of application related folder and its confirm that no any other application refering that file for any perpose then u can delete it using custom action.