I am working on a relevance to check if any EOL versions of .Net are installed.
Anything that is not version 10 or version 11 should give a true result of the relevance, then the actions will remove it.
But this relevance seems to show 10 as a True rather than a false result.
exist "DisplayVersion" whose ( it as string does not start with "10" or it as string does not start with "11") of keys whose ((it as string contains "Microsoft .NET SDK" ) of value "DisplayName" of it ) of key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry
If I change “exist” to “values” in Fixlet Debugger it shows this version.
Output : 10.4.426.53019
Please can someone help me with this. All help is much appreciated.
Q: exists values "DisplayVersion" whose (it as string does not start with "10" and it as string does not start with "11") of keys whose ((it as string contains "Microsoft .NET SDK" ) of value "DisplayName" of it ) of key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry
A: False
2 things I noted.
You are checking "DisplayName" not the value of "DisplayName"
Using "OR" means that as "10.4.426.53019" does not start with 11, that would trigger the True so you should use "AND"
An approach I'd use, which makes it easier to add/remove major versions and is slightly better performance would be (EDITED to cater for x86 & x64)
Q: exists value "DisplayVersion" whose ((major revision of (it as string as version)) is not contained by (set of (10;11))) of keys whose (value "DisplayName" of it as string contains "Microsoft .NET SDK") of keys "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (registry ; native registry)
A: True
T: 0.479 ms
I: singular boolean
vs the string comparison from your method
Q: exists values "DisplayVersion" whose (it as string does not start with "10" and it as string does not start with "11") of keys whose ((it as string contains "Microsoft .NET SDK" ) of value "DisplayName" of it ) of key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of registry
A: True
T: 3.287 ms
I: singular boolean