Apologies if this seems like a noob question...but I can't figure this out for the life of me. I'm using WQL to query WMI for the Dell BIOS version in a task sequence in SCCM. That WQL Query is below:
select * from WIN32_BIOS where SMBIOSBIOSVersion < "1.10.5"Simple enough. This step will run (and install the latest version of Dell's BIOS) if the version of BIOS on the machine that is running the sequence is less than the current version, 1.10.5. Long story short...the step didn't run. So I got to investigating.
On the machine that the task sequence was supposed to run, the BIOS version is 1.7.3. I pull open a command prompt and run the following...
wmic BIOS get SMBIOSBIOSVersionWhich returns 1.7.3. HOWEVER...when I run the WMIC query below, I get "No Instances Available"
C:\>wmic BIOS where "SMBIOSBIOSVersion < '1.10.5'" get SMBIOSBIOSVersion
No Instance(s) Available.Running the query with the ">" instead of "<" gets the desired result.
C:\>wmic BIOS where "SMBIOSBIOSVersion > '1.10.5'" get SMBIOSBIOSVersion
SMBIOSBIOSVersion
1.7.3I'm stumped. 1.10.5 is greater than 1.7.3 (clearly) even in hexadecimal form (I checked in case this was some weird anomaly).
Removing the single quotes doesn't work as the query becomes invalid. (IE "SMBIOSBIOSVersion > 1.10.5")
Again, my apologies if this is a noob question. I'm fairly new to WMI and querying using WMIC and WQL. I don't necessarily need the correct script. I really want to know exactly why this result is not as I expected.
71 Answer
As pointed out in the comments, the SMBIOSBIOSVersion property is a string. Therefore, comparisons are done only on the text characters; the numeric value represented by the text isn't considered. For example, the string 9 would sort after 8, but also far after 10 because 1 sorts before the bigger digits. (Possibly relevant: ASCII Table.)
You should do your comparisons on the SMBIOSMajorVersion property and SMBIOSMinorVersion, if necessary. Source: Win32_BIOS at MSDN. If you end up needing to check both, the and operator does exactly what you expect.