I need to uninstall an application based on returned version value from an exe file.
Is there a way to use a fixlet relevance to check the version of an exe file from a specific location on disk?
Example from windows cmd:
C:\wmic datafile where name=“C:\Program Files\Notepad++\notepad++.exe” get version
Do you just need to decide whether to uninstall based on a version, or does something like the command line or the path to the command change based on version? In your example, the path and command lines for uninstalling notepad++ do not change based on the version number.
Ok, you’d put that in the fixlet’s Relevance then, so it returns a True if the version you want to uninstall exists.
The Relevance would then be something like
exists native files "C:\Program Files\Notepad++\notepad++.exe" whose (version of it = version "8.6.9.0")
Here I use the ‘native files’ inspector so it inspects the real path; the normal ‘files’ inspector is subject to Windows 32-bit Redirection, so it would have actually checked in the Program Files (x86) folder.
For maximum portability we can also use the native program files folder inspector, in case any of the folder names are changed from the defaults (like if multiple Languages/Locales are supported in your deployment)
exists files "Notepad++\notepad++.exe" whose (version of it = version "8.6.9.0") of native program files folder
Examples… both could be tweaked or modified for needs and/or optimization.
(version of file “msedge.exe” of folder “Microsoft\Edge\Application” of program files x32 folder as string) | “N/A”
if (exists file “C:\Program Files\Qualys\QualysAgent\QualysAgent.exe”) then (version of file “QualysAgent.exe” of folder “C:\Program Files\Qualys\QualysAgent” as string) else “N/A”