Fully Uninstalling Windows Applications

When an MSI based Application is uninstalled, it removes the file system changes that it is aware of, specifically the files, folders and registry keys that it directly created. Items that are specific to the application, but were not created by the MSI itself will not be removed by default.

Items not removed can include user generated data, user specific settings created under the user's profile, and user specific registry keys. Many Applications create file system changes when they first launch and these changes are frequently user specific. License files are also potentially left behind as well. Items applied via Group Policy will also not be removed when the MSI is uninstalled.

Not fully removing an application can have negative implications. Retirement of an application may require removal of the license files from each workstation. Failing to remove user specific data may have security implications. Stranded user specific registry keys may interfere with other applications. Customizations from one package may cause other applications to not function correctly. 

Since the MSI can only remove what it knows about, two possible options that can be pursued to create a more thorough uninstallation are:

1. Build into the MSI the additional logic to allow for a clean uninstall. This will work, but is time consuming and will not account for any changes that occur with the package after it is installed, so is not a viable solution.

2. Using another method to remove the extra items after removing the application. 

The second option has been the path in the past, usually implemented with a VB or CMD script. VB and CMD do have limitations on what they can be used to remove from the system and one area these two methods are not particularly useful for is the removal of User specific registry keys. Fortunately, a PowerShell script has more capabilities than a VB or CMD script and can be designed to target each item that needs to be removed.

Using PowerShell, an application removal script can be created that will remove the following:

• Application files stranded by the uninstall of the application

• User specific files under C:\Users, for all users on the machine

• User specific registry keys, for all user IDs on the machine, regardless if the user is logged in or not

• Any other file system changes that need to be removed

Olenick has created a toolkit for the installation and removal of application packages, which incorporates the functionality described above. Implementation of this methodology in multiple client environments has been highly successful to date.

Author: Peter McDaniels - Lead Senior Consultant

This site uses cookies to provide you with a more responsive and personalized service. By using this site you agree to our use of cookies.

Please read our cookie policy for more information on the cookies we use. Olenick’s privacy policy is available here.

More information Ok Decline