If you want to be notified when your app is uninstalled, you can do that from your uninstaller
A customer had a rather strange request. “Is there a way to be notified when the user uninstalls any program from Programs and Features (formerly known as Add and Remove Programs)?”
They didn’t explain what they wanted to do this for, and we immediately got suspicious. It sounds like the customer is trying to do something user-hostile, like seeing that a user uninstalled a program and immediately reinstalling it. (Sort of the reverse of force-uninstalling all your competitors.)
The customer failed to take into account that there are many ways of uninstalling an application that do not involve navigating to the Programs and Features control panel. Therefore, any solution that monitors the activities of Programs and Features may not actually solve the customer’s problem.
The customer liaison went back to the customer to get more information about their problem scenario, and the response was, that the customer is developing something like an App Lending Library. The user goes to the Lending Library and installs an application. They want a way to figure out when the user uninstalls the application so that the software can be “checked back in” to the library (available for somebody else to use).
The customer was asking for a question far harder than what they needed. They didn’t need to be notified if the user uninstalled any application from the Programs and Features control panel. They merely needed to be notified if the user uninstalled one of their own applications from the Programs and Features control panel.
And that is much easier to solve.
After all, when an application is installed, it registers a command line to execute when the user clicks the Uninstall button. You can set that command line to do anything you want. For example, you can set it to
UninstallString = "C:\Program Files\Contoso Lending Library\CheckIn.exe" 〈identification〉
〈identification〉 is something that the
CheckIn program can use to know what program is being uninstalled, so that it can launch the real uninstaller and update the central database.