Uninstall ImmyBot - please update documentation to not use win32_product WMI?

The FAQ at Frequently Asked Questions | immy.bot recommends using wmic product where name="ImmyBot Agent" call uninstall /nointeractive to uninstall ImmyBot. This is a bad recommendation as it’s never recommended to call wmic product, in addition to WMI being retired soon by Microsoft. See https://xkln.net/blog/please-stop-using-win32product-to-find-installed-software-alternatives-inside/ for reference.

I would recommend updating the documentation with a better recommendation for uninstallation. I’ve run into issues where this does not complete, pulling the UninstallString from the registry and adding /quiet /norestart: MsiExec.exe /X{EB351E99-77D1-4EBB-BD54-D18F55C8D758} /quiet/norestart or seems to hang forever; it would be great if that worked!

I have had more luck but less testing downloading the installer and running:

msiexec /x installer.msi /quiet norestart

But I’d love a generic recommended documented option that doesn’t use WMI or win32_product for removing the agent, ideally one that’s easily deployed via PowerShell via an RMM as part of a cleanup or fix attempt that consists of removal and reinstall to repair.

Thanks!

@dszp

Get-Package -Name "ImmyBot Agent" | Uninstall-Package -Force

This appears to work fine when I’ve tested it.
Do you see any issues with the use of Get-Package and Uninstall-Package?

I haven’t tried it again recently, if Get-Package and Uninstall-Package are supported on a system (I’ve seen computers where they are not), I imagine it would work fine. I’m not doing this directly any longer, I have an ImmyBot deployment script that can optionally do a version check and upgrade if it’s out of date, or just display version info, or uninstall using the registry information to start the uninstallation via msiexec:

However, I do think it’s irresponsible to list the Win32-Product call in the documentation when that’s recommended to never be used for the reasons indicated at the link.

Running the uninstall for ImmyBot agent from ImmyBot works, and generates a similar commandline to

MsiExec.exe /X{EB351E99-77D1-4EBB-BD54-D18F55C8D758} /quiet /norestart

…that you referred to above, and it works. The problem is that the GUID you’ve used in your example isn’t necessarily the ImmyBot agent. Further, the documented method does actually work (vs your provided example).

Not sure what you’re really looking for other than a more complex script/set of commands to uninstall when what’s in the docs still works fine on every version of windows that exists.

It works, but even Microsoft advises against using the Win32_Product class where possible. This is because it inherently runs a consistency check on ALL software on the machine, even when it’s just a query. This means that if your 365 apps so much as sneeze, it will be considered bad and your query for a completely unrelated app, the Immy agent, will initiate an unannounced repair install of that 365 app. This is mentioned in the Microsoft documentation for Win32_Product.

That being said, I’m pretty sure I’ve complained about this enough times that alternative methods were documented and, I think, used in the overall Immy uninstall script lol

I wrote the uninstall script that is currently in the repository for ImmyBot agent–and it is not specific to ImmyBot and uses the appropriate method for uninstalling ImmyBot Agent.

The point you guys are making is clear and understood. But I think you’re ignoring some realities here with respect to what is documented:

  1. If folks are uninstalling ImmyBot(and don’t have another tool that can uninstall it unattended), they presumably need something simple that will work for them with whatever tools they have. Some organizations disable powershell in their environments, or insist on not having powershell in their environments. The documented method works regardless of this, again, on all versions of Windows that currently exist, even unsupported Windows versions (that people are still running).

  2. If they are using ImmyBot but want to uninstall the agent, that can be done with the inbuilt Immy Deployment, and the documented method is not needed.

  3. Microsoft has made that recommendation because Win32_Product is not query optimized, they have chosen not to optimize it, and also unnecessarily initiates a consistency check–again, that’s not an Immy problem, these are all Microsoft problems that they have basically said they won’t alter or fix.

So, my personal opinion here is that this is a non-issue. Again, I get and understand the recommendations, but I personally wouldn’t spend any time coming up with complex scripts and methods for something that can be uninstalled with a one-liner command, or by just clicking uninstall in add-remove programs.

That’s all fine, my real issue is that the official ImmyBot FAQ I linked to at Frequently Asked Questions | immy.bot is actively recommending using the very not-recommended way, and doesn’t even warn that it shouldn’t be done. I believe an alternate option should be recommended in the official documentation; if people choose to do the problematic thing on their own that’s fine.

My issue and the report here was purely about the official docs containing something they should not, and they still do. I believe they’re open to contribution and I’m GitHub-savvy enough I can probably pull it off now, so I’m willing to submit a pull request to change it if that’s preferred. (I was not really much of a Git/GitHub user when I posted my original post here).

You make a good case regarding PowerShell possibly being disabled or unusable.

Regarding the “simple script” concept though, I don’t see how having a somewhat longer script is any different than having a giant one-liner of an install script for the Immy agent. Just my thoughts on that.

What else can you run with powershell disabled that will reliably find the registry key for the uninstaller and run the appropriate uninstall command? (This is really the point I’m making)

Sure, produce a reliable script (non powershell) that works on all Windows versions that exist and I can certainly have that evaluated. I’ll even make sure your email address is present in the docs for folks to know you contributed it! :slight_smile:

1 Like

I suppose you could still query the uninstall registry paths and run the uninstallstring value with “/qn /norestart” appended. If you’re iffy about the guid though, it might be a little slow since it would need to iterate over all those guids to find one where the display name is “ImmyBot Agent”. Technically should be doable with just a batch script, though

1 Like

That’s a good point. I honestly consider PowerShell a required feature and rarely consider how to do anything without it any more :slight_smile: And I’m no batch scripting fan. But I do see benefit to an uninstallation option that doesn’t use it.

I will contemplate working on a non-PowerShell version that uses batch to locate the uninstall command and run it via msiexec rather than using WMI, which sounds like it’s what you’re asking for, and I’ll be happy to contribute it if I can pull it off.

Perhaps a warning with a link to one of the more well-written version (maybe the Microsoft KB link from Dakota?) prefixing the existing FAQ item and warning that it’s not recommended and may cause unintended side-effects per Microsoft would be sufficient to at least let people know it’s more of a last-ditch thing that may not always be safe? And perhaps the Get-Package version could be listed as a safer alternate one-liner if it works as a first attempt rather than jumping right to Win32_Product?

I do agree my UninstallString was not necessarily accurate for all ImmyBot installers; I assume it changes from version to version and that’s why querying the UninstallString by searching the registry for the name is standard way to find/uninstall, which is all my PowerShell uninstall function does, a little more verbosely.

I think Dakota has already posted the batch-script method (in concept at least–it’s what I was thinking of) before I even had a chance to publish this–the live updating threading here is pretty cool :slight_smile:

@dszp Technically the docs are available in Github, you could fork it, make the changes you’d like to see and submit a PR. Takes a little while to get reviewed and merged though haha

That’s what I was looking at, already cloned it and looked at it locally, haven’t gotten to forking yet.

A quick online search pulls up Batch script to extract Uninstall string & software name pair from registry - Programming & Development - Spiceworks Community which seems to be a good batch starting point, though I haven’t tested yet. No promises on timing of an actual script but I might do something short of that with a PR, we’ll see…depends on how long the ADHD focus lasts or when it returns :smiley:

@dszp One option I had thought of for simplifying the complexity involved in a batch script is hosting it either on github or maybe azure. Then you could literally just point to the page and run the script. Someone did something like this with chocolatey where it’s just:

wget choco.run -o c.cmd; .\c.cmd
or
irm choco.run | iex