Return Uninstall string from reg UninstallString value

Problem we often get asked to remove unwanted applications, with few details provided on the product, like how to uninstall it.
thanks to the code from SLB on post Uninstall application
with a slight change to his code it can now be used as a tool to return the uninstall string when you only know what the program might be called. with this we can setup an analysis and return all the uninstall strings for all versions of the product we are trying to remove.

unique values of (values “UninstallString” of keys whose (((it contains “reasonlabs”) of (value “DisplayName” of it as string as lowercase))) of keys “HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall” of (registry ; native registry) as string)

4 Likes

Thanks for sharing!

I always introduce a property called “Applications - Uninstall Strings - Windows” that I use relevance like:

unique values of (it as string) of (value "displayName" of it as string | name of it as string, values "uninstallString" of it) of keys of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)

This returns every single app and uninstall string including whether it ends with a null terminator or not.

A: 7-Zip 22.01 (x64), "C:\Program Files\7-Zip\Uninstall.exe"
A: Adobe Acrobat (64-bit), MsiExec.exe /I{AC76BA86-1033-1033-7760-BC15014EA700}%00
A: Adobe Refresh Manager, MsiExec.exe /I{AC76BA86-0804-1033-1959-018244601042}%00

This is great because when I want to build an uninstall fixlet I can go into web reports, search for entries that include “7-Zip” and instantly see all the different uninstall strings for that app in my environment. So for 7-Zip you’d find Uninstall.exe for ones installed with the EXE installer and you’d see msiexec /x for ones installed with the MSI installer. It also helps you figure out if you’ll need different handling across versions or x64/x86.

You can also get relevance to do some of the argument work for you in this with things like this:

(if (it ends with "}" and it as lowercase contains "msiexec") then (it & " /qn REBOOT=ReallySuppress /norestart") else (it)) of (concatenations "" of substrings separated by "%00" of concatenations "MsiExec.exe /x" of substrings separated by "MsiExec.exe /I" of it) of unique values of (it as string) of (value "displayName" of it as string | name of it as string, values "uninstallString" of it) of keys of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)

You can use this to automatically switch it to uninstall instead of configure and add your required skip reboot and silence flags to the msiexec commands.

A: 7-Zip 22.01 (x64), "C:\Program Files\7-Zip\Uninstall.exe"
A: Adobe Acrobat (64-bit), MsiExec.exe /x{AC76BA86-1033-1033-7760-BC15014EA700} /qn REBOOT=ReallySuppress /norestart
A: Adobe Refresh Manager, MsiExec.exe /x{AC76BA86-0804-1033-1959-018244601042} /qn REBOOT=ReallySuppress /norestart

This is really great for beginners because it doesnt require them to know a lot about msiexec to get work done!

And if you really want to go big there’s an exercise left to the reader here where you pull these results from the REST API and use a script to automatically build and upload uninstall fixlets for every app in your environment :slight_smile:

6 Likes

This is great stuff!
thank you

So this is awesome since I’ve been wondering about how to get uninstall commands for software in our environment, I do have two questions:

1 - Jow do you handle exe’s for silent installation? For example for VLC player running trying to find help on the uninstall.exe C:\Program Files\VideoLAN\VLC>uninstall.exe /? just kicks off the uninstaller itself, there’s no help menu for silent, I tired /q, /qn, /quiet, /s, /silent to no avail.

2 - For those of us that dont know anything about:

Is there cheat-sheet somewhere to help get started on this? :slight_smile:

And before submitting my post the silent switch is /S (capital S), I mean without having to go on a google search for each uninstaller exe file, is there a better option?

Thanks!