cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tcom36
Level 7

Uninstalling user ini files

I have an InstallScript MSI project. The installer creates/writes ini file into C:\Documents and Settings\All Users\Application Data\\. As InstallShield installed these files here during installation, it does also remove them on uninstall.

Now, when the user runs the application, he might change some settings for himself only. In that case, the application writes the ini-files under C:\Documents and Settings\\Application Data\\. These files do not get removed on uninstall.

These files do however not make sense leaving on the PC once the application is removed. Is there any way to make InstallShield remove these files?
Labels (1)
0 Kudos
(7) Replies
mberterm
Level 7

While it does not make sense to leave behind files, unfortunately, it is a known MSI limitation that files not found in the current user's folders or common folders are left behind.

You might cautiously consider a custom action which iterates through all user profiles--but if not done carefully you might not have sufficient privileges or you might delete things best left behind.

Although, maybe I misunderstand the scenario. Are the files put there merely upon installation of the package or by your application?
0 Kudos
tcom36
Level 7

Thank you for your reply.

When the application is installed for all users, the installer puts ini files into
C:\Documents and Settings\All Users\Application Data\\
These files are also removed by the installer.

But when a user runs the application, the application saves private settings into
C:\Documents and Settings\\Application Data\\
These files are left behind when uninstalling.

I think I will need an installscripts iterating through all Application Data folders. AppDataFolder does not fully help here as it gives the full path. I should somehow retrieve from it the base part (C:\Documents and Settings\) and the specific part (Application Data\\) in a way which works as well on XP as Vista, whatever language of Windows...
0 Kudos
mberterm
Level 7

But when a user runs the application, the application saves private settings into
C:\Documents and Settings\\Application Data\\
These files are left behind when uninstalling.

That explains it. New files, those not included in the installation package and modified files (ie. like the application saving private settings) are explicitly left behind by MSI at uninstallation.

In this case, if you want to leave no foot prints behind, yes these files will need to be cleaned up rather manually; through a custom action of some sort.
0 Kudos
DebbieL
Level 17

Note that some installation authors intentionally leave behind the user-specific files in case the user wants to reinstall the software. (If the user-specific files are uninstalled and then users have to reinstall the software, they have to reconfigure everything.)

-Just something to think about.
0 Kudos
tomerdr
Level 6

Not sure if you can use it since you have unknown users

but maybe it will help

http://msdn.microsoft.com/en-us/library/aa371201(VS.85).aspx
0 Kudos
mberterm
Level 7

I ran across a posting by Susan Gorman at Lifestyle of the MSIdle that goes into some of the ups and downs of cleaning up user data... Common Task: Optionally Cleanup User Data on Uninstall

In the comments she explains that she uses the native MSI tables instead of custom actions to leverage the table driven aspect of MSI allowing this functionality to be more readily seen (assisting in the maintainability as well).
0 Kudos
tcom36
Level 7

Thanks for the replies.

I finally wrote an InstallScript which cleans up the ini files and the directories where the are located (if the folders are empty).
0 Kudos