Relevance substitution inside parameter

Hi,
I’m trying to uninstall an Intel Wi-Fi software from our machines.
the software has a different ProgramID for each version, nothing I haven’t dealt with before.
usually i would take the UninstallString from the registry that has the software name and run that.
simple, right? wrong.
this software has a typo (thanks, Intel) and the UninstallString is actually (for example in one of the versions):

MsiExec.exe /I{68A981A0-ED59-41E0-B45E-7A78F643120D}

Using /I (to install) instead if /X (to uninstall).
weirdly enough, I see this quite often…

So I need to extract the SoftwareID as parameter and attach it to MSIEXEC /X, and this is where I hit a snag.
i am able to extract the correct ProgramID from QnA:

Q: first 38 of following text of last "/I" of (values "UninstallString" of it as string) of (keys whose(value "DisplayName" of it as string = "Intel® PROSet/Wireless WiFi Software") of keys "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of native registry)
A: {68A981A0-ED59-41E0-B45E-7A78F643120D}
T: 6.492 ms
I: singular substring

I put it into an action:

parameter “IntelProWifiuninstall”="{(first 38 of following text of last “/I” of (values “UninstallString” of it as string) of (keys whose(value “DisplayName” of it as string = “Intel® PROSet/Wireless WiFi Software”) of keys “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of native registry))

delete c:\temp\IntelProWifiuninstall.bat
createfile until __end
msiexec /X"{parameter “IntelProWifiuninstall”}" /qn /norestart
__end
move __createfile c:\temp\IntelProWifiuninstall.bat
run c:\temp\IntelProWifiuninstall.bat

but I got this error:

Command failed (Relevance substitution failed)

I am pretty sure this is because the result itself has curly brackets, but how can i escape them when using a parameter?

Thanks!

You can cheat a bit, and just use the key name

name of key whose (value "DisplayName" of it as string = "Intel® PROSet/Wireless WiFi Software") of key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of native registry

Or you can pick out the value using the %-encode characters. From memory (I’m sitting in my garden, typing on my phone), %7b & %7d

preceding text of last "%7d" of following text of last "%7b" of (value "uninstall string" of it) of keys whose(value "DisplayName" of it as string = "Intel® PROSet/Wireless WiFi Software") of keys "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of native registry)

2 Likes

@trn, Thanks for your reply
using your idea and removing the parameter part, the task is working:

delete c:\temp\IntelProWifiuninstall.bat
createfile until __end
msiexec.exe /X {name of key whose (value “DisplayName” of it as string = “Intel® PROSet/Wireless WiFi Software”) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of native registry} /qn /norestart
__end
move __createfile c:\temp\IntelProWifiuninstall.bat
run c:\temp\IntelProWifiuninstall.bat

Thanks!

I use this method. I find it clean and easy to read/update if needed.

//Using name and specific version. For when you have more than 1 version of the same software installed
parameter ""="{names of keys whose (value "DisplayName" of it as string contains "" and value "DisplayVersion" of it as string contains "") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)}"

//Using only the software name
parameter ""="{names of keys whose (value "DisplayName" of it as string contains "") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)}"

if {exists parameter ""}
waithidden msiexec.exe /X{parameter "" & " /qn"}
endif
4 Likes

Nice! Added to internal KB :slight_smile: