I'm going to start posting questions from my "packaging exam" which I use for screening job applicants for one of our larger customers. Being that I also work on the packaging and deployment team, I've compiled these questions from past experience as well as past interviews. The questions are continuously updated, and I can't post all of them, so I'm planning to post just a sampling of them over a few days span.
Scenario: You've performed an uninstall of a software application which was originally installed from an MSI package. Afterwards, you've discovered that the product installation folder as well as several files within it and in sub-folders beneath it were left behind.
Question: What is/are the most likely reasons these items were left behind?
A. The files were added or modified after the initial installation
B. The files were "in use" by another process at the time of the uninstall
C. The files were marked as "hidden" or "system"
D. You ran the uninstall without Administrator level permissions.
Correct Answers: A, B
A. An MSI installation (Windows Installer) uses a manifest-oriented approach to mapping uninstall processing with the original installation changes. If objects are added after the installation, they are not considered part of the original installation and are left alone. Being that they are left alone, the folders in which they reside cannot be safely deleted.
B. Files which are marked as being "in use" by a process (or service, also a process), are locked from deletion. In order to delete the files, you must stop any services which use the files, and/or terminate processes which are using them.
A common approach to performing "clean" uninstalls is to include TASKKILL or (Sysinternals') PSKILL requests to terminate processes, as well as SC or PSSERVICE (Sysinternals) to stop running services, prior to beginning the main uninstall. This helps to ensure files are not in use while the uninstall is being executed. Even though many installers will include robust handling of services and processes, many more do not bother.
For removing leftover folders and files, the old "RD" command will usually suffice. For leftover Registry keys, the REG command is usually sufficient as well.