none
Query BIOS Version Before Running Command or Installing Application?

    Question

  • I have a task sequence that queries the computer model and then runs a BIOS update if the model matches.

    If the BIOS is already up to date, the BIOS update application doesn't update the BIOS and the deployment continues. Everything is OK, but then we get a yellow summery screen at the end saying the BIOS update task had an error code.

    Is there a way to filter the BIOS update task so that it only runs when the model matches AND the BIOS version is below a certain value?


    • Edited by MyGposts Sunday, April 27, 2014 7:03 PM
    Sunday, April 27, 2014 7:02 PM

Answers

  • We have Dell computers and this is what I did for all 23 different models. I would add each BIOS version as an application and insert a Dell E4300 BIOS Update install based on these options.

    Sample: Dell Latitude E4300

    If ALL conditions are true 

    WMI query SELECT * FROM Win32_ComputerSystem WHERE Model LIKE "%Latitude E4300%"

    WMI query select * from WIN32_BIOS where SMBIOSBIOSVersion < "A26"

    This will only update the BIOS IF the model detected is E4300 AND the BIOS is less than A26

    I hope I have been helpful.........



    • Edited by Prince Ali Ababwa Wednesday, August 6, 2014 10:09 PM
    • Marked as answer by MyGposts Thursday, August 7, 2014 2:30 AM
    Wednesday, August 6, 2014 10:09 PM
  • to get the current version of BIOS, this seems to work for me (on this particular machine)(YMMV):
    wmic bios get smbiosbiosversion

    SMBIOSBIOSVersion
    G6ET99WW (2.59 )

    you could grab the returned value, and compare that with the version string that your update would apply, then, only apply the update if a lower version is detected.


    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

    • Marked as answer by MyGposts Thursday, August 7, 2014 2:31 AM
    Sunday, April 27, 2014 9:35 PM

All replies

  • to get the current version of BIOS, this seems to work for me (on this particular machine)(YMMV):
    wmic bios get smbiosbiosversion

    SMBIOSBIOSVersion
    G6ET99WW (2.59 )

    you could grab the returned value, and compare that with the version string that your update would apply, then, only apply the update if a lower version is detected.


    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

    • Marked as answer by MyGposts Thursday, August 7, 2014 2:31 AM
    Sunday, April 27, 2014 9:35 PM
  • What is the syntax to add that query check is the smbiosbiosversion is less that something such as a bios version that has both letters and numbers.

    For example when I query my machine is says: 

    SMBIOSBIOSVersion
    K01 v02.05
    Sunday, April 27, 2014 11:52 PM
  • There's bound to be a lot of ways you could approach this - assuming you would use a TS step, with a WQL condition, like this example:
    http://scriptimus.wordpress.com/2011/06/22/mdt-2010-using-wmi-queries-with-task-sequence-step-conditions/

    In pseudocode; yours might be "if bios version<>theupdateversionIhaveinthispackage, then apply the biosupdate"

    e.g.

    select smbiosbiosversion from win32_bios where smbiosbiosversion <> "K01 v.2.05"

    [if the condition returns NULL, the bios version is at this version, so no bios update needed]
    [if the condition returns a value, the bios version is not at the packaged version, so apply the bios update]
    [note: this very simple condition does not allow for *newer* bios version being found in the machine!]

    I haven't tested this logic, you should do so.


    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

    Monday, April 28, 2014 9:06 AM
  • What is the syntax to add that query check is the smbiosbiosversion is less that something such as a bios version that has both letters and numbers.

    For example when I query my machine is says: 

    SMBIOSBIOSVersion
    K01 v02.05

    Use a WMI condition on the particular task in the task sequence. Provide the following WMI query:

    Select * FROM Win32_BIOS where Version like "%K01%"

    Or to be precise:

    Select * FROM Win32_BIOS where Version = "K01 v02.05"

    LIKE can be used with wildcards

    = can be used for exact values

    Learned it from Keith Gartner very recently ;)


    If this post is helpful please click "Mark for answer", thanks! Kind regards

    • Proposed as answer by MrBrooks Wednesday, August 6, 2014 3:51 PM
    Monday, April 28, 2014 1:24 PM
  • Is there a "less than" filter?

    We need the BIOS upgrade task to be skipped when the BIOS version is already at the version we want.

    We need all items to be matched or else skip the command.

    PC model must match and BIOS version must NOT already be at the version we want to apply.

    It would be nice if it could also recognize a higher version BIOS and skip applying the BIOS update in that case also.

    Wednesday, August 6, 2014 3:46 PM
  • Check it: http://msdn.microsoft.com/en-us/library/aa394605(v=vs.85).aspx

    WQL operators, less than. Should be possible!

    for example, if BIOS version is less then 4.00 execute the action, or something like that :)

    Cheers!


    If this post is helpful please click "Mark for answer", thanks! Kind regards

    Wednesday, August 6, 2014 8:00 PM
  • We have Dell computers and this is what I did for all 23 different models. I would add each BIOS version as an application and insert a Dell E4300 BIOS Update install based on these options.

    Sample: Dell Latitude E4300

    If ALL conditions are true 

    WMI query SELECT * FROM Win32_ComputerSystem WHERE Model LIKE "%Latitude E4300%"

    WMI query select * from WIN32_BIOS where SMBIOSBIOSVersion < "A26"

    This will only update the BIOS IF the model detected is E4300 AND the BIOS is less than A26

    I hope I have been helpful.........



    • Edited by Prince Ali Ababwa Wednesday, August 6, 2014 10:09 PM
    • Marked as answer by MyGposts Thursday, August 7, 2014 2:30 AM
    Wednesday, August 6, 2014 10:09 PM
  • Also...

    Don't forget the ZTIBIOSCheck.wsf script in MDT itself.

    THe documentation is sparse, but can get your started.


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Monday, August 11, 2014 5:09 PM
    Moderator
  • Hi MyGposts,

    Did you have your answer ? I have the same problme for HP Computers who as BIOS version like "K01 v0.98"

    How did you do finally ?

    Thanks

    Wednesday, January 27, 2016 1:19 PM
  • @Prince Ali Ababwa,  have you had to change your detection for the new version numbers?

    We had the same script for our older machines, but the new ones now have versions like 1.5.3

    If we use the same script, in certain cases the BIOS will not install.

    e.g. The test (1.5.3 < 1.17.1) returns FALSE.

    Friday, August 18, 2017 6:52 AM
  • @Prince Ali Ababwa,  have you had to change your detection for the new version numbers?

    We had the same script for our older machines, but the new ones now have versions like 1.5.3

    If we use the same script, in certain cases the BIOS will not install.

    e.g. The test (1.5.3 < 1.17.1) returns FALSE.

    SMBIOSBIOSVersion, is a string, not an integer. 

    So, comparison operators such as "<" or ">" don't operate as you might expect.
    When you compare strings which have "seemingly numeric" values, those values aren't evaluated as numbers, rather, each character is evaluated from left-to-right, one character at a time.
    So your clause gets to the third character and is evaluating: "is 5 < 1 ?"

    So, change your WQL to use a more appropriate comparison operator, or, change your logic/approach.
    This may need to adapt for the non-standardised ways used by different vendors, who are at liberty to populate the value with any string they please.

    Consider using 'LIKE' or some other operator. Here's some examples:

    https://blogs.technet.microsoft.com/heyscriptingguy/2012/07/13/use-the-like-operator-to-simplify-your-wql-queries/

    Or, consider using SystemBiosMajorVersion and SystemBiosMinorVersion (if your systems support that. my Win10 Lenovo X1 Yoga does ;)


    Don [doesn't work for MSFT, and they're probably glad about that ;]




    • Edited by DonPick Friday, August 18, 2017 10:36 AM
    Friday, August 18, 2017 10:31 AM
  • Thanks Don,

    I did look at the SystemBiosMajor and SystemBiosMinor fields, but unfortunately, they do not work well for Dell.

    For some reason both 1.16.5 and 1.17.1 have a Major of 3 and a Minor of 0.I will have a look at the LIKE option, and see if I can make it work.

    A few nested IFs might be able to get it to work.

    If anyone has come up with a working solution, please share, as it would be very useful to others.

    Monday, August 21, 2017 3:43 AM
  • Thanks Don,

    I did look at the SystemBiosMajor and SystemBiosMinor fields, but unfortunately, they do not work well for Dell.

    For some reason both 1.16.5 and 1.17.1 have a Major of 3 and a Minor of 0.I will have a look at the LIKE option, and see if I can make it work.

    A few nested IFs might be able to get it to work.

    If anyone has come up with a working solution, please share, as it would be very useful to others.

    borrowed this from a mailing list. this is showing ConfigMgr TaskSequence step condition, but it illustrates one way to use OR, within WQL (note that this may not be a working example, sorry about that)


    Don [doesn't work for MSFT, and they're probably glad about that ;]


    • Edited by DonPick Monday, August 21, 2017 9:42 PM
    Monday, August 21, 2017 9:40 PM
  • Please see below pic

    Tuesday, August 22, 2017 1:42 PM
  • Thanks for reply.

    That Query just selects a range of Bios version numbers.

    I would need to know every existing bios version, and list them all in there.

    While technically that would work, it is not the most efficient solution.

    I'm thinking that

    SMBIOSBIOSVERSION <> "[latest version number]"

    is probably best way to go. Just need to ensure that a newer BIOS version isn't introduced prior to updating the script.

    Tuesday, August 29, 2017 4:27 AM
  • Thanks for reply.

    Does that actually work?

    I get a bunch of syntax errors when I try to run it.

    Tuesday, August 29, 2017 4:28 AM
  • Since you are using MDT, why not querying the value of SMBIOSBIOSVersion task sequence variable?

    Personally I use PowerShell to query current BIOS version and then run a string comparison to determine if the current BIOS version is the expected BIOS version:

    Get BIOS version:

    $CurrentBIOSVersion = (Get-WmiObject WIN32_BIOS).SMBIOSBIOSVersion
    $tsenv.Value("SMBIOSBIOSVersion") = "$CurrentBIOSVersion"

    Then, you could execute a program (for example BIOS update), based on the Model name / current BIOS version:

    $Model = $TSenv.Value("Model")

    Switch ($Model){ "HP Elite x2 1012 G1"{ Write-Host Logit "$Model is a supported model" $ExpectedBIOSVersion = "N85 Ver. 01.20" Write-Host "Expected version is $ExpectedBIOSVersion" Write-Host "Current Version is $CurrentBIOSVersion" if ($ExpectedBIOSVersion -EQ $CurrentBIOSVersion){ Write-Host "Correct Version, nothing to do" Exit 0 } else { Write-Host "Incorrect version, trying to fix that..." $bios = "$PSScriptRoot\HP\Updates\HP Elite x2 1012 G1\HPBIOSUPDREC64.exe" $cmdLine = '-s -p password.bin -b -r' Write-Host "Cmdline set to $cmdline" Start-Process $bios "$cmdLine" -Wait $tsenv.Value("NeedReboot") = "YES" Exit 0 } }

    }



    Blog - http://www.vacuumbreather.com / http://www.wcsaga.com

    Tuesday, August 29, 2017 6:50 AM
  • For anyone else who comes across this blog, here is the CM application detection powershell script I'm using on Dell Latitudes. 

    $Update = "1.18.6"
    $Updatemajor ="3"
    $Version = Get-WmiObject win32_bios 
    if ($Version.SMBIOSMajorVersion -ge $Updatemajor -and $Version.SMBIOSBIOSVersion -ge $Update)
    {Write-host "installed"
    }
    else
    {
    }


    Tuesday, April 24, 2018 12:15 AM
  • Checking the literal BIOS version can be problematic because it's a string and can therefore have other letters or symbols before/after the actual number.  A LIKE comparison won't always be enough, especially if you want to only flash if the version is older, with a LESS THAN operator <.

    An improved approach is to use ReleaseDate instead, which seems to be more reliable and consistent overall.

    gwmi -query 'select SmBiosBiosVersion,ReleaseDate from win32_bios'
    gwmi -query 'select * from win32_bios where releasedate < "20180705000000.000000+000"'

    Wednesday, November 7, 2018 6:13 PM