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 SMBIOSBIOSVersion

Which 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

I'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.

  • Did you try where SMBIOSBIOSVersion < 1.10.5 (ie no quotes at all? – DavidPostill Nov 22 '16 at 21:41
  • Yes sir I did. That's what I meant when I said "Removing the single quotes doesn't work as the query becomes invalid." Apologies that wasn't clear. Edit - sorry I see you meant no quotes at all. I did and unfortunately that returns an error "The system cannot find the file specified" – dr4g1116 Nov 22 '16 at 21:42
  • 2
    Win32_BIOS class's SMBIOSBIOSVersion property is a String not a numeric data type. Seems like the <, >, <=, and >= operators have unexpected results. If someone doesn't come up with a work-around, I'll add this as an answer. – CConard96 Nov 22 '16 at 21:52
  • 3
    My guess is the comparison is using a lexicographical order sort not a natural (numerical) sort. I don't know how to fix this apart from parsing the version yourself in a batch file. – DavidPostill Nov 22 '16 at 21:53
  • 2
    If you compare string with a lexical sort order then 1.0 < 1.10.5 < 1.7.3 < 1.9.5 < 2.0 – DavidPostill Nov 22 '16 at 21:59

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.

  • Ah good resource! Thank you so much for this. I will check to see if I can use the Major and Minor versions. My assumption is that I can...just need to see how exactly these attributes are affected upon upgrading to the latest. Assumption being that Major should be checked first, then minor. – dr4g1116 Nov 22 '16 at 22:01
  • Marking this as the answer because you explained exactly why this was behaving as such. Thank you. My fault was thinking that the string comparison would have seen "10" and not "1" and "0," which definitely would sort before 7, 9, etc. – dr4g1116 Nov 22 '16 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.