This is a follow up post continuing from the Modern BIOS Management post in June (http://www.scconfigmgr.com/2017/06/02/modern-bios-management-using-web-services-during-osd-with-configmgr/) which focused on Dell hardware.

Following the post we had numerous requests to apply the same logic for other manufacturers. So here is the first of which, the update being for Lenovo systems:

As my current environment is virtually all Dell, I had to reach out to come members of the ConfigMgr community to perform tests of modified scripts so I would like to thank Zeng Yinghua (aka Sandy – @sandy_tsang), Eugeny Korneev (@eugeny_korneev) and Lauri Kurvinen (@etsmii) for putting in long hours of testing on their Lenovo devices.

Note that I am not going to step through the entire process in this post, so please refer to the original post for set up instructions.

How Does It Work

The same process used in the original post linked at the top of this post is used, the process uses a web service and WMI queries in PowerShell to match available packages. To cater for Lenovo systems we have updated our BIOS Package Detection script so if you are already using this, please update the script.

BIOS Package Detection Script (At least version 1.0.4):

https://github.com/SCConfigMgr/ConfigMgr/blob/master/Operating%20System%20Deployment/BIOS/Invoke-CMDownloadBIOSPackage.ps1

In order to cater for Lenovo systems we have created an update script which looks at the content of the downloaded package and determines the update method to apply. This was required as Lenovo have two different methods using either their WinUPTP or FlashCMD utilities. The script also takes into account whether the process is to be run in WinPE as this process is only supported by the 64 bit version of the WinUPTP utility.

BIOS Update Script (Lenovo):

https://github.com/NickolajA/PowerShell/blob/master/ConfigMgr/OS%20Deployment/Invoke-LenovoBIOSUpdate.ps1

Update In Action

In the below screenshot you can see the process of matching an available download to the model currently running the task sequence:

In this next screenshot you can see an output of the bios update log:

Lenovo Model Matching

Having had a lot of feedback recently from community members with Lenovo based client deployments it became clear that matching Lenovo models based on the Get-WmiObject -Class Win32_ComputerSystemProduct | Select-Object -ExpandProperty Version method was somewhat hit and miss for some Lenovo models.

To help cater for this the script has been updated to work in conjunction with an update for the Download Automation Tool (version 4.0.9) which now writes all product types associated with a model name into the package comments in ConfigMgr.

Below is an example of a BIOS package for a Lenovo ThinkPad T460

As you can see there are 10 distinct product type values which should provide a match for this package, so during the Invoke-CMDownloadBIOSPackage.ps1 stage we obtain a full list of packages which contain a match based on the first four digits of the Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty Model value, which should coincide with the model types.

If multiple packages are found, we then try to match on the name of the package against the product name (obtained from Get-WmiObject -Class Win32_ComputerSystemProduct | Select-Object -ExpandProperty Version value). The reason for this is clear if we take the example of the ThinkPad T460 and the T460S, both similar but separately named models so you would imagine that the machines would distinct in their model type codes, however this is not the case;

T460 Model Types – 20FN 20FM 20FN 20FM 20FX 20FW 20FX 20FW 20FA 20F9

T460S Model Types – 20FA 20F9

You might ask then if that is the case then surely a single package would work for both, and where as you might be correct we found that the T460s BIOS download in this instance contained a subtle difference in the sub version relating to the embedded controller was different. In the case of the T460, the download included 09 of the embedded controller software, where as the T460S contained version 11.

Version Checking

Version checking for Lenovo models has also been overhauled as the value obtained from Get-WmiObject -Class Win32_BIOS | Select-Object -ExpandProperty SMBIOSBIOSVersion does not always fall into a sequence that can be easily compared. So for Lenovo hardware we are now comparing the BIOS release date, which again works in conjunction with details contained within the package contents.

Once a match has been found, the script sets a TS environment variable called “NewBIOSAvailable” with a value of “True“. This then enables you to filter your Download BIOS Package and Run BIOS Update Script actions based on a query to see if the value is equal to True. This saves you attempting to flash the bios with the same version during your task sequence.

Things To Note:

In order for the BIOS to apply the system will require a shutdown. For this purpose Lenovo recommend either using a command-line shutdown or setting the SMSTSPostAction variable set to use the “SMSTSPostAction” variable and the value set to “shutdown /s /t 0 /f”. More info at – https://forums.lenovo.com/t5/Enterprise-Client-Management/M800-M900-BIOS-Update-in-SCCM-2012/td-p/3493768.

Nicke Källén also has a blog post with an alternative method for getting past the shutdown requirement – http://www.applepie.se/task-sequence-and-shutdown-not-reboot-a-computer-and-continue

BIOS Packages – Note that due to changes in the way in which the packages are named and the comments included, you will need to remove and replace your existing Lenovo BIOS packages created with this tool.

Feedback

If you have any feedback on this please ping me an email at maurice@scconfigmgr.com

Nickolaj Andersen
Principal Consultant and Enterprise Mobility MVP. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows deployments and Automation. In 2015 Nickolaj was awarded as PowerShell Hero by the community for his script and tools contributions. Author of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService and a frequent speaker at user groups.

(2842)

Maurice Daly

Maurice has been working in the IT industry since 1999 and was awarded his first MVP Enterprise Mobility award in 2017. Technology focus includes Active Directory, Group Policy, Hyper-V, Windows Deployment (SCCM & MDT) and Office 365.

comments
  • Skylar
    Posted at 18:33 July 26, 2017
    Skylar
    Reply
    Author

    Just realized that I grabbed my scripts from https://github.com/NickolajA/PowerShell, instead of https://github.com/SCConfigMgr/ConfigMgr. I’ll try with the actual updated script.

  • Skylar
    Posted at 20:55 July 26, 2017
    Skylar
    Reply
    Author

    Okay, new issue. Now I get a failure just after it runs Invoke-CMDownloadBiosPackage.ps1. I checked the logs and found an error that read:
    “Method invocation failed because [Selected.System.Management.ManagementObject] does not contain a method named SubString:
    At C;\_SMSTaskSequence\Packages\SS10006A\Invoke-CMDownloadBiosPackage.ps1:184 char:4

    • Maurice Daly
      Posted at 22:18 July 26, 2017
      Maurice Daly
      Reply
      Author

      Try it now. I should have included -ExpandProperty, the script has been updated.

  • Cody Mathis
    Posted at 12:11 July 29, 2017
    Cody Mathis
    Reply
    Author

    Nice! I was actively working on this. I already had the ‘pick the bios package’ piece written, but I like your “Invoke-LenovoBIOSUpdate” better than mine. For the download piece though with Lenovo, what worked GREAT for me was is below. Because your bios/driver tools tosses in that 4 character Lenovo model, I’ve just been doing a substring match and getting great results. I just populate a $LenovoModel variable if the manufacturer is Lenovo.

    #this is all in my variable section
    $PC = Get-CimInstance -CimSession $CIMSession -ClassName win32_computersystemproduct -Namespace root\cimv2
    $Vendor = $PC.Vendor
    if ($Vendor -match “lenovo”)
    {
    $Model = $PC.Version
    $LenovoModel = $PC.Name
    }
    else
    {
    $Model = $PC.Name
    }
    #this is all in my variable section

    #and this is part of my get-biospackage function
    if ($LenovoModel)
    {
    Write-CMLogEntry -Value “Computer is $Vendor – Found BIOS Update packages, now checking for a match on $($LenovoModel.SubString(0, 4))”
    $CheckModel = $Results.where{ $_.PackageDescription -match $LenovoModel.SubString(0, 4) }
    }
    else
    {
    Write-CMLogEntry -Value “Computer is $Vendor – Found BIOS Update packages, now checking for a match on $Model”
    $CheckModel = $Results.where{ $_.PackageName -match $Model }
    }
    #and this is part of my get-biospackage function

    • Cody Mathis
      Posted at 13:09 July 29, 2017
      Cody Mathis
      Reply
      Author

      Ignore my comment! I just went back through your code and it does exactly what mine does =) you check for the lenovo model, and then the “model” as a double check if needed.

  • Mario F.
    Posted at 18:13 August 1, 2017
    Mario F.
    Reply
    Author

    Thanks for these scripts and your effort to simplifying every CMAdmins job!

    I have been using your Driver Automation tool and driver scripts without fail. However, having a hard time getting the BIOS files to download. Checking the BIOSPackageDownload.log, it finds the number of BIOS packages I have, but does not enumerate the models available in the log. All Lenovo here so any help would be appreciated

  • Mario F.
    Posted at 20:44 August 1, 2017
    Mario F.
    Reply
    Author

    Disregard – went through your BIOSDownload script a bit more and found some typos/misplaced hashtags (line 166 and 169). Working great now!

  • Skylar
    Posted at 23:32 August 1, 2017
    Skylar
    Reply
    Author

    Looks like line 169 needs to be commented out in the most recent version of Invoke-CMDownloadBIOSPackage.ps1.

  • Mario F.
    Posted at 22:02 August 2, 2017
    Mario F.
    Reply
    Author

    I’ve been testing this against systems where they BIOS was updated using the scripts supplied here, but subsequent TaskSequence runs still have the BIOS files downloading (even if the BIOS is matched). Has anyone had success with the NewBIOSAvailable TS Variable?

    • Maurice Daly
      Posted at 23:43 August 2, 2017
      Maurice Daly
      Reply
      Author

      Hi Mario,

      It appears that in some instances the new version of the BIOS is not updating the release date. Can you confirm this is the case here?.

      Maurice

      • Mario F.
        Posted at 01:50 August 3, 2017
        Mario F.
        Reply
        Author

        Hi Maurice. I will check tomorrow and respond with my findings.

        • Mario F.
          Posted at 15:33 August 3, 2017
          Mario F.
          Reply
          Author

          Seems that you are correct. My two test systems (TP13 Gen 2 and X1 Carbon 3rd Gen) have mismatched dates. How is the release date being generated in the package comments section? Lenovo supplied xmls in the automated download tool?

  • Leave a Reply