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

Uninstall­String = "C:\Program Files\Contoso Lending Library\CheckIn.exe" ⟨identification⟩

where ⟨identification⟩ is something that the Check­In program can use to know what program is being uninstalled, so that it can launch the real uninstaller and update the central database.

Comments (28)
  1. Yukkuri says:

    But Contoso products are so awesome no one would ever uninstall them on purpose! It had to be an accident!

  2. Joshua says:

    "My responses are limited. You must ask the right questions."

  3. Thomas Freudenberg says:

    And still you can copy the program files to another location before uninstalling the application. Or even just invoke the content of UninstallString manually.

    [Of course, if you copy the files before uninstalling, you're going to get in trouble the next time the company does a software licensing audit. The purpose of the customer's system is not to be bulletproof. It's to automate what is currently a manual procedure. -Raymond]
  4. Boris says:

    But why would a piece of software need to be checked out / checked in? Limited number of licenses and no floating license server? Limited number of client connections and no way to prevent them server-side? I believe this is the first time I've heard of this concept.

  5. Kemp says:

    @Boris – I don't think it's a "need" so much as a new way of implementing recurring charges to the user.

  6. Ray says:

    I can think of one use case:

    Enterprise environment: Make sure no one uninstalls mandatory AV/Malware/VPN software.

    (and yes, a hacker could work around it, but it's defense in depth – most people wouldn't expect the uninstaller to "phone home")

  7. Evan says:

    @Ray: would file system permissions be too boring?

  8. Joshua says:

    @Boris: They wrapped software that doesn't natively have that ability.

    [That's almost certainly the reason. Contoso bought 100 copies of Fabrikam Designer and they want to make sure it is never installed on more than 100 computers. -Raymond]
  9. A hacker isn't going to bother calling your uninstaller; they will just do what your uninstaller does, minus the notification.

  10. alegr1 says:


    If an user can uninstall software, it's not enterprise environment. It's just a bunch of home computers.

  11. Boris: We use software at work that activates against an online server when you install it.  When you uninstall it calls back to the same server and it decrements the installed count by one, so you can install it again elsewhere.  If it fails for any reason you have to kick them to get them to do it manually.  

    The only machine that has it is a build machine, so when I had to shift everything after a previous incarnation died and thus I couldn't uninstall, I had to get them to manually decrement the installation count.

  12. John Ludlow says:

    @Chris: InstallShield, by any chance? I've had to do something similar. In fact, our version is so old that the activation server no longer supports it.

    @alegr1: Not necessarily true. A team of developers will generally expect to be administrators of their workstations (and to a certain extent, servers). In fact some development tools will flat out fail if you don't have admin privileges. However, we are still expected to have stuff like AV, and this is enforced by policy. I guess it would have been possible for the corporate bootstrapper tool to call back to a server if you try to uninstall the AV suite.

  13. morlamweb says:

    @alegr1: I disagree.  Enterprise networks do not prohibit users from uninstalling software by definition.  My office computers are domain-joined Windows 7 and Windows 8 PCs and I can uninstall software from all of them.  The ability to uninstall software is more directly controlled by user rights and by the policies that are enforced by the domain.

  14. alegr1 says:

    >Enterprise networks do not prohibit users from uninstalling software by definition.

    Ask Ed Snowden about that.

  15. Anon says:

    @alegr1 Snowden was a domain administrator. He could do whatever he pleased to any machines he wanted.

    He wasn't merely on the wrong side of the hatch, he was also given a master key and an arc welder.

  16. cheong00 says:

    @John Ludlow: Agreed.

    While Visual Studio does allow you to debug programs launched by yourself, when I once got a job in environment that does not grant administrator access to developers, I decided to quit ASAP.

    It's plain painful and non-productive when you can't get your handy tools to load.

  17. cheong00 says:

    Off topics: "-ms-hyphens"? It's the first time I see people using this CSS style. Curious whether they'll add -moz-hyphens later

  18. xpclient says:

    Raymond talks as if Microsoft actually cares about user-hostility in products. :O

  19. I'd wish for having a feature like this: If a user deletes a folder the system beforehand checks for the existance of a certain file inside (let's call it desktop.ini for example). If a certain setting inside the file is found Explorer would not delete the folder but point the user to an uninstaller.

    Could be really useful to get a proper uninstall instead of a deleted application folder.

    Unfortunately it could also be really nice to hijack for evil deeds.

    Thought experiment: When the location is inside Program Files this should be rather safe?

  20. Joker_vD says:

    @Georg: "This app's uninstaller is broken, so you have to go to delete the folder manually, and then remove those three files in other places. Also, you may wish to delete those two branches in the registry, but that's not necessary". I've seen such an instruction.

    Also, what's worst could happen if you don't uninstall the application, but instead delete the application's folder? Yeah, there are some leftovers here and there, and the system thinks the app is still installed, but I doubt that would hinder the re-installation. When the installer starts, it checks the registry to see if the app's has already been installed, and if it was, where exactly, then it looks at that place and if it doesn't exist, it assumes the app isn't actually installed and goes on, right?

  21. Neil says:

    @cheong00: I see -moz-hyphens in the "source" of css/DynamicStyle.aspx:

           hyphens: auto; -ms-hyphens: auto; -moz-hyphens: auto; webkit-hyphens: auto; -o-hyphens: auto;

  22. poizan42 says:

    @Chris: Easy fix:

    1. Install the software in a vm

    2. Make a snapshot.

    3. Uninstall software.

    4. Restore snapshot.

    5. Goto 3. while licenses in use > 0

    6. ???

    7. Profit!

  23. Nick says:

    @Georg: There's nothing stopping you from writing that shell extension.

  24. DWalker says:

    @xpclient:  What was the purpose of your comment?  Just trying to be rude?

  25. Yukkuri says:

    @DWalker xpclient likes to tantrum in the comments here, just ignore him.

  26. cheong00 says:

    @Neil: Strange… It didn't show up on developer's toolbar yesterday but show up today.

  27. @xpclient: For your purpose, and judging by the evidence at hand, you can either assume that Microsoft pretends to care or indeed cares. After all, it is an antivirus company. Before you mention it, yes, I have seen the Microsoft Security Essentials article on Wikipedia and its corresponding page on AV-TEST. That's why I said the first part of my first sentence.

    @Raymond: "…and we immediately got suspicious"

    Getting suspicious shows your intelligence; writing or saying it is incongruous. Cumberbatch who plays Sherlock Holmes utters such sentences but he receives approx. $1250 for each of those sentences.

  28. Dave Bacher says:

    Blah, it's so that they can display:


    Please don't uninstall me!  Give me another chance, please?  PLEASE?  Pretty please with sugar on top?

    OK, alright, uninstall me but tell me why:

    [ ] Crashes my computer constantly

    [ ] Interferes with other apps

    [ ] Sang out of tune

    [ ] Other: _________

    Thank you for using Contoso Corporation products, have a nice day.  Don't forget to look us up on your mobile device at (obsolete product link), (obsolete product link), (nonfunctional product link)



    Office.com would be an example of an app that works this way — I have 10 device seats, across 5 users.  I can go and install it on 10 computers, and run it on 10 computers.  It's not concurrent seats — it's 10 total installs.  When I uninstall, the install becomes available for use again.


    If they were going to do something like force a reinstall…

    …why would they provide a working uninstaller in the first place?

Comments are closed.

Skip to main content