9.2.5 Agents, Windows 10, and Version as string relevance

I was looking to see why Windows 10 machines were not becoming relevant for one of our Automatic Groups in BigFix and came across the following for version of operating system/version of operating system as string. Are the relevance statements in bold false positives? Or is casting as string not used correctly here? Thanks!

Windows 10 Output, 9.2.5 Client and 9.2.5 Fixlet Debugger

q: version of operating system
A: 10.0.10240
T: 0.027 ms
I: singular version

q: version of operating system as string
A: 10.0.10240
T: 0.027 ms
I: singular string

q: version of operating system > “6.0.0”
A: True
T: 0.030 ms
I: singular boolean

q: version of operating system > “10.0.0”
A: True
T: 0.032 ms
I: singular boolean

q: version of operating system as string > “10.0.0”
A: True
T: 0.032 ms
I: singular boolean

q: version of operating system as string > “6.0.0”
A: False
T: 0.038 ms
I: singular boolean

Windows 8 Output, 9.2.5 Client and Fixlet Debugger

q: version of operating system
A: 6.3.9600
T: 0.022 ms
I: singular version

q: version of operating system as string
A: 6.3.9600
T: 0.025 ms
I: singular string

q: version of operating system > “6.0.0”
A: True
T: 0.031 ms
I: singular boolean

q: version of operating system > “5.0.0”
A: True
T: 0.030 ms
I: singular boolean

> q: version of operating system as string > “10.0.0”
> A: True
> T: 0.034 ms
> I: singular boolean

q: version of operating system as string > “5.0.0”
A: True
T: 0.040 ms
I: singular boolean

q: version of operating system as string > “6.0.0”
A: True
T: 0.038 ms
I: singular boolean

The relevance results are correct. This is not a bug.

If one or both sides of the comparison are a version, then version comparison is done.

If both sides of the comparison are strings, then string comparison is performed.

You almost always want version comparison, not string comparison.

See this:

q:"10" > "6"
A: False

q:"10" as version > "6"
A: True

In the first case, 1 is compared to 6. 6 is greater than 1, so the comparison evaluates to false. No further processing is performed. Also, I don’t believe it is actually comparing 1 to 6, it is comparing the ASCII code values. Look at the result of "6" > "+" for an example of what is actually happening.

In the second case, because “10” is cast as a version, then version comparison is done. “6” is also silently cast as a version behind the scenes. Then a comparison equivalent to the following is performed:

Q: 10 > 6
A: True

Version comparison is a bit tricky and not always intuitive. String comparison is even more confusing. It will work in many cases, but not in others.


1 Like

Cool - with that explanation, this looks to be working and makes sense now. Will have to remember these nuances down the line. Thanks!

1 Like

Edit: Doh! Sorry – skimmed too quickly over the post. This can be ignored

Something that really helped me with these was to enable, “Show type information” in Fixlet Debugger under View.

This will tell you what type of object was returned from your relevance query:
Q: "10.0.0.1"
A: 10.0.0.1
T: 0.020 ms
I: singular string

This helps me to build relevance queries as you can look at the inspector guide and know exactly what is supported, what properties there are, and what object you are currently returning.

But @cdh is clearly doing exactly that by looking at the original post, but your tip on “show type information” is definitely useful in general for those that aren’t aware of how to do that.

I agree in general, but in this case there are odd things happening behind the scenes with strings and versions that aren’t really documented.

1 Like

My apologies – edited my reply due to my lack of thoroughness on this topic.

I agree though – i’ve independently witnessed dozens of people running into this and I can’t imagine the number of people who have this issue and waste countless hours on it only to find a simple answer.

Almost makes you wish you couldn’t easily cast a version to a string! Then people wouldn’t just add as string on the end and get stuck

1 Like

This is definitely a case of something that is very hard to explain or document. Either you have your head wrapped around it or you don’t and it takes quite a while to get there.

How can “as version” be implemented in something like this?

exists value "DisplayVersion" whose (it < "14.8.0.1010") of keys "CitrixOnlinePluginPackWeb" of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)

Give it a try:

exists values "DisplayVersion" whose (it as string as version < "14.8.0.1010" as version) of keys "CitrixOnlinePluginPackWeb" of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)
1 Like

Ha! That’s it. I knew it was simple. I’ve seen where you first have to cast to string, then to version before forgot (and don’t understand why). Anyway, it works now. Thank you for your time!