Question

I'm a developer in need of ammo.

If the user chooses to uninstall your program, what do you do with the data your program kept in HKEY_CURRENT_USER, and other parts of the user profile?

The program stores user data (logs, etc) in the user folders. The client wants an uninstall to remove all those data...for all users. At the same time, the an ordinary non-admin user should be able to do the uninstall.

I've not been able to find a whitepaper, documentation or otherwise that says this shouldn't be done. The closes is Raymond Chen's post: http://blogs.msdn.com/oldnewthing/archive/2007/09/17/4948130.aspx

But a blog post is weak ammo.

Alternative : Create %SYSTEMDRIVE%\FooProgramData during install. All users write to this folder. This is ugly, I know. But this is the only way I can think of that can satisfy the "on-uninstall-all-files-must-be-cleared" requirement.

Thoughts? I need a better alternate (if one exists) or a solid whitepaper, documentation or logo requirement that says uninstalls shouldn't delete user data.

Was it helpful?

Solution

"At the same time, the an ordinary non-admin user should be able to do the uninstall."

A non-admin account should never (and should never be able to) alter other users' data.

The absolute most you could do in that case is delete the current user's data, and even then you should prompt or give a warning.

Go with Raymond, it may just be a blog post, but Raymond could be considered no ordinary blogger :)

EDIT: I've just found http://msdn.microsoft.com/en-us/library/bb204770.aspx#uninstall_clean but it doesn't say anything explicit about user data

OTHER TIPS

Uninstalls should delete all client data, except when the client doesn't want it to :)

Or, put it another way, a generic uninstaller should give the user the choice of whether to delete the data or not.

In your case, where you've got a customer who specifically wants the data removed, I guess that's what you're going to have to do, but there's no clean way of doing that if the uninstall is going to be run by a non-admin unless you do as you suggest and store the data someplace where every single user has full filesystem access.

I don't know for specificities of Windows, but as a user I'd like that my data don't get lost if I uninstall a software. Some arguments are:

  • Other programs may be able to handle the same data
  • I could later change my mind and reinstall the software
  • Other people could need the data, which I could mail them

Removal of all per-user data should be a separate process to the uninstall.

My recommendation (and what we do) would be to create a separate "cleanup" utility that must be run as an administrator and will enumerate through the profiles removing additional user files. Optionally it could also enumerate the users registry hives and removing additional registry keys, etc. One of our clients has their own custom scripts that does exactly that.

I would then provide the customer with this cleanup tool and say after uninstall, if you want to remove all user data then use this.

Consider the following cases

  • Customer uninstalls prior to installing a new version
  • Major upgrades (which will uninstall the old version so you need to be aware of this)
  • Accidental uninstall by a user who shouldn't have done it but had the ability to do so

The cleanest way to remove this data for all users that I can think of would be to take advantage of Active Setup and use this to trigger a per-user script that runs the next time each user logs on. The data won't be deleted during the uninstall, but at the next logon. And you'll leave a few registry entries lying about, however it would be less likely to cause corruption than enumerating user profiles.

I would never delete user and/or configuration data when uninstalling. If the user really wants it all gone she should do it herself.

I know I'm a few years late to this party, but as I am looking for an answer to this myself right now, I ran into the following new MSDN article: http://msdn.microsoft.com/en-us/library/windows/apps/jj553522.aspx.

It relates to Metro Style apps, but is probably relevant for other types of applications. Their explanation gives some much needed distinction between different kinds of user data and it may help a developer decide whether to delete a file or not. Without this distinction, it is understandable that there is such varying opinions on whether or not to delete files during uninstall:

There are two kinds of data that apps frequently manage or interact with:

App data

Data that the app itself creates and manages. It is mutable data specific to the internal functions or configuration of a particular app. It includes runtime state, user preferences, reference content (such as the dictionary definitions in a dictionary app), and other settings. App data is tied to the existence of the app and is only meaningful to that app.

User data

Data that the user creates and manages when using an app. It includes document or media files, email or communication transcripts, or database records holding content created by the user. Note that user-selected preferences or app configuration options are considered app data, not user data. User data is useful independent of a single app may be useful or meaningful to more than one app. Often this is data that the user wants to manipulate or transmit as an entity independent of the app itself, such as a document.

Note the sentences shown here bold italics. If the files in question are meaningless without the application, if they are containing user preferences for that application (such as user.config), then it should not be considered user data even though it may be located in a user data directory. It should be considered to belong to the application and be deleted on uninstall.

That being said, I still am looking for simple ways to do this for other users than the current user! I am considering moving all that data into directories for App data so that I more easily will be able to remove them and without having to mess in individual user's User data stores.

My recent "smart think" pours out in a recommendation to create "readme.txt" file in corresponding user's folder when the program first runs. The file should contain instructions which files for what are and also a disclaimer with 'feel free with clean-up this folder' :-)

Just for clarification the question, I've created one more, specifically related to Windows Logo certification: Windows Logo clean uninstall.

I've raised an old dilemma but want to know which one choice Microsoft recommends.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top