Why do Windows Installers (.msi files) take so much longer to uninstall than other installers?

07
2014-07
  • Chris S

    Since the Windows XP days, Windows Installers (.msi files), including InstallShield installers (which is just a bootstrap for MSI) has taken around five times longer to uninstall an application than other installers. The same is also usually true about installing.

    Why do they still take this long, and why do people still use MSI for installing? For example:

    Uninstall VLC - takes around 5 seconds.
    Uninstall XYZ - launches "Preparing to remove..." followed by a 15 second delay.

    All it's doing is removing files and cleaning the registry (which may include COM registrations), so why does it take so long?

  • Answers
  • harrymc

    Windows installer first systematically creates a system restore point, which is a quite slow operation.

    Also from the article entitled, appropriately, "Windows Installer sucks", an excerpt:

    It used to be that installation would consist of a program executing and taking a few simple steps to install your software, then do the reverse on uninstallation.

    That's not how Windows Installer works. Instead of running a program to simply install and let it be done with, it examines the state of your system, then examines the state of the database that is the program's installer, then does a series of overcomplicated calculations about how to reconcile the two.

    It seems that, instead of running an installation script, it goes about solving a traveling salesman problem. Which is why it runs so slow. Or at least, that's my impression.

    I also add that Windows installer keeps all information in the registry, which is not the world's fastest database.

  • A Dwarf

    Windows Installer indeed has a reputation for being slow. There are a few things that contribute to this and I'm going to address them below. But ultimately, one should ask themselves if one, two, or three minutes is really a matter of contention when installing and uninstalling software. I take more time than that flipping through TV channels :)

    The Registry
    This is the culprit number one. Windows Installer makes heavy use of the registry for its operations. As your system matures, as you install and uninstall applications and as the registry grows in size or becomes fragmented, MSI will become slower. The same application will install and uninstall much faster on a pristine Windows installation, than it will on a matured system. The solution here is to try and keep the registry clean and defragmented.

    For registry cleaning, use one of the many tools available out there. But for registry defrag I cannot recommend enough NTREGOPT for internal hive optimization and PageDefrag for physical file defragmentation.

    The reason MSI operations may become slow on the registry has to do with how MSI uses it. Windows Installer uses the registry to keep track of which Products have installed which Components and to which Location it was installed. The original installation GUIDs are used in compressed format. Per-machine information about installs can be found at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18, whereas per-user data is found next to it on a under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\ and on a key with the user SID.

    Both these keys can be quite large and contains numerous subkeys and values. They control Products, Components and KeyPaths of each installed application. All this information must be read and processed for a correct uninstallation procedure. However the registry format lists keys in alphabetic order which allows for binary searches. But the values are not. They are stored as they are created, so a linear search procedure must be performed. Which slows down the algorithm performance.

    All in all, MSI is a rather complete and accurate method for installation and uninstallation of software. But it suffers from its registry dependency. The system is excellent. It is the Windows registry that should have had its overhaul a long time ago :)

    For more advanced information:
    For a deep analysis of what MSI is doing during each install or uninstall procedure, refer to this article that explains how to setup MSI Debug. Or, for less but still valuable information, this one one how to activate logging.

  • Glytzhkof

    Windows installer has many big advantages for corporate deployment, some of which I have described here: http://serverfault.com/a/274609/20599

    Much of the slowness of a Windows Installer session is due to its rollback capabilities. Firstly it creates a restore point prior to install or uninstall (provided system restore hasn't been disabled). Then it will back up all affected files during both uninstall and install to ensure that the system can be restored to its original state should an error occur.

    Another contributing factor is that all components in the MSI will be registered in the registry. This involves some overhead.

    For compiled MSI files some time is also needed to extract the install files.

    See this answer for technical details for speeding up MSI installations.

  • Breakthrough

    Windows Installers are so commonly used for many reasons - operating system integration, security policies, unattended installations, and much more.

    The most common reason I can think of is the unattended installations, and network distributions. Large corporations can easily distribute applications, by having the .MSI file on a network drive, and then just calling a batchfile (or distribution wizard application) on a remote machine to automate the install process.

    While other options exist outside of the .MSI files, there are some unique features which integrate with most versions of Windows that a lot of other installers don't have.

    And just so you know - InstallShield is not always a front-end to MSI files. They also have their own proprietary installation solution.


  • Related Question

    Can't uninstall app in Windows because it's looking for the original msi file
  • Tony_Henrich

    I am trying to uninstall an application from the add/remove applications applet. However the uninstaller is looking for the original msi installer from my temp folder.

    I don't have the msi file anymore and it's an older version of the app. I tried using Microsoft's installer cleaner tool but the uninstaller is stiill looking for the msi file.

    What's a good way to completely and cleanly remove the app? I don't want just to delete the folder and manually delete registry entries.


  • Related Answers
  • John T

    Take a look at Revo Uninstaller.

    Revo Uninstaller helps you to uninstall software and remove unwanted programs installed on your computer even if you have problems uninstalling and cannot uninstall them from "Windows Add or Remove Programs" control panel applet.

    Revo Uninstaller is a much faster and more powerful alternative to "Windows Add or Remove Programs" applet!

    With its advanced and fast algorithm, Revo Uninstaller analyzes an application's data before uninstall and scans after you uninstall an application. After the program's regular uninstaller runs, you can remove additional unnecessary files, folders and registry keys that are usually left over on your computer. Even if you have a broken installation, Revo Uninstaller scans for an application's data on your hard disk drives and in the Windows registry and shows all found files, folders and registry keys so you can delete them.

    With its unique "Hunter mode", Revo Uninstaller offers you some simple, easy to use, but effective and powerful methods for uninstalling software. You can use it to manage your installed and/or running software programs.

    Revo Uninstaller is free and there is also a portable version available.

  • NT.

    As a simple solution.Reinstall the application by using installer.Then try to remove it...Good luck...

  • harrymc

    I would suggest to :

    1. Try John's idea of using Revo Uninstaller. Only if it doesn't work, continue.
    2. Delete manually anything you know belongs to the application, including Start menu entries and its installation directory.
    3. Clean the registry using, for example, CCleaner.
    4. Use Microsoft's installer cleaner tool to erase all traces of the installation.