Search code examples
sccmwqlversion-numbering

WQL/SCCM - Comparing version numbers correctly (less than...)


I'm having a problem with this part of a SCCM WQL query looking for "less than version 75.0.3770.80":

... where SMS_G_System_ADD_REMOVE_PROGRAMS.Version < "75.0.3770.80"

If i'm not mistaken this is the good old problem seen before in other scenarios (file names for example) where it will return objects with version number :

75.0.3770.142   

Because in it's logic "of course" .142 is "less than" .80 because .1 is less than .8. It doesn't treat it as "142 versus 80" but "1 versus 8"

Is there any way I can work around this? I'm getting a lot of false positives with this query and need to filter them out. If it was straight Powershell I could cast it as [version] but in SCCM, is it at all possible to do this comparison?


Solution

  • Ended up using SMS_G_System_ADD_REMOVE_PROGRAMS.Version < "75.0.3770"