Lenovo BIOS update script

This script can be used in a task sequence (MDT or SCCM) to upgrade the BIOS on Lenovo PCs eg. during Operating System Deployment.In MDT I have imported the script as an application. The firmware files must be located with the script source folder in sub folders e.g. “T460” .

The install command is “cscript.exe LenovoBIOS.vbs” (name the script file LenovoBIOS.vbs).

           

Then I install the application as a step in my task sequence. The installation step should be placed after the computer has applied the operating system and has re-booted into full Windows (not WinPE). Since the logic for selecting the right firmware is in the script, i don’t have any conditions on the task sequence step. Put a Restart Computer step right after the BIOS upgrade step. The actual upgrade of the firmware takes place during the re-boot.

You may have to resume BitLocker after the BIOS upgrade and subsequent re-boot (Windows 7). Please test thoroughly before deploying to production.

EDIT (2020-05): The script below is quite old now, so please remember to update it with the latest BIOS version numbers e.g. “G1ETB1W” as specified by Lenovo.

10 Comments

Join the discussion and tell us your opinion.

Erik Mirandareply
2018-06-06 at 23:57

Hi WinTech, I was hoping you can help me with the following request. I’m in the process of trying to automate and silently update all of our Lenovo systems BIOS via the MDT OS Deployment process. I’ve been researching this topic and testing several ways but I’ve only manage to get it working by adding the BIOS folder for each model as an application in MDT. I then add it to my task sequence as an ( Install application) which the application copies the BIOS folder from MDT to the local system into ( C:\Windows\Temp ) Then in my task sequence ( Install application) I’ve created two WMI Query, one for BIOS Version and one for models. If all conditions are true, it runs a batch with the corresponding silent switches. Inside the batch file I’m using the following information below. I saw your script and it seems more unify and a one stop shop option as a single process. Can you please guide me on how to use this in MDT… I’m assuming everything goes inside one folder and you are running it within a task sequence. I’m not a big scripter as I’m still in the learning curve. Can you please assist me with this request.
Thanks in advance
Erik
@Echo off
REM Copy_M92p_BIOS_Files
REM Upgrade_M92p_BIOS
xcopy.exe “%deployroot%\Applications\ThinkCentre M92p BIOS V-9AA\*.*” “C:\Windows\Temp\M92p” /Q /H /E /I /Y
timeout /t 5
Echo Updating M92p BIOS…
c:
cd Windows
cd Temp
cd M92p
start /WAIT wflash2.exe IMAGE9S.CAP /bb /rsmb /quiet
Echo Installation completed!

windowstechreply
2018-06-08 at 10:11
– In reply to: Erik Miranda

Hi Erik

Thanks for commenting 🙂
I have added som more info to the post. Hope that was what you were looking for. There is no need to manually download the firmware upgrade files to c:\windows\temp\.

Br
Peter

Erik Mirandareply
2018-06-12 at 23:21

Hi Peter, thank you for the prompt response and all the screenshots and information to use in MDT. I followed your instructions to the “T” however; the script seems to run for a second then it just disappears. The only line item I changed was adding the latest BIOS version number in the script to reflect the most current version for my test M92P system as shown her below.
If StrModel = “THINKCENTRE M92P” And StrCurrentBIOS < "9SKT9AA" Then
PerformUpdateDesktops "M92P","afuwin.exe image9s.cap /p /n /sp /q"
End If
I had one quick concern, how does your script logic determine if the system already has the latest BIOS update and skip the process? By the way, I also deleted the Bitlocker portion at the end of the script as I have it already being process using the (Invoke-MbamClientDeployment.ps1) from Microsoft and it works great for Win 7 and Win 10. One thing I did was to revise my current BIOS update batch file by using the switches for the (AFUWIN.EXE) that I saw on your script, it actually works even better than using the switches for the (wflash2.exe) I had originally. The BIOS Updates actually is being process within the OS environment vs. on the reboot stage. I'm including the updated batch file information for your review, this is actually working perfect in the OS environment. I still would like to use your (LenovoBIOS.vbs) but I can't seem to get it working. If possible can you e-mail me directly to (erikmiranda@bayviewassetmanagement.com) so I don't overload this comment and post area with several screenshots.
Thanks again
Erik
—————————————————————————————-
@Echo off
REM Copy_M92p_BIOS_Files
REM Upgrade_M92p_BIOS
xcopy.exe "%deployroot%\Applications\ThinkCentre M92p BIOS V-9AA\*.*" "C:\Temp\M92p" /Q /H /E /I /Y
timeout /t 5
Echo Updating M92p BIOS…
c:
cd Temp
cd M92p
start /WAIT AFUWIN.EXE IMAGE9S.CAP /P /N /SP /R
Exit
Echo Installation completed!
——————————————————————————————-

Erik Mirandareply
2018-06-13 at 01:10

Hi Peter, just in case you can’t reply to my e-mail the following is what I have so far in my MDT as per your instructions
Script and BIOS folder has been created and imported as and (Application along with the command)
cscript.exe LenovoBIOS.vbs
.\Applications\Lenovo BIOS Upgrade
The folder along with the script is created in (C:\DeploymentShare\Applications\Lenovo BIOS Upgrade) inside it contains the script and BIOS folder
LenovoBIOS.vbs
M92P
Added the application as in the task sequence right after the OS boots for the first time under (State Restore)
Lenovo BIOS Upgrade
Restart computer

windowstechreply
2018-06-14 at 09:18
– In reply to: Erik Miranda

Hi Erik
I sent you an email. Did you get it ?

Erik Mirandareply
2018-06-15 at 19:58

Hi Peter, I did replied to your last -mail and I also included some additional information regarding Lenovo BIOS updates for your review. Not sure if you got all three e-mails I sent. I also wanted to ask you if anyone has access to post screenshots on your comments section on this page. I was trying to add some the other days, but was not able to do so.
Again, thank you for all your help
Erik

Mike Niccumreply
2018-07-02 at 19:01

The BIOS I download for the M92P does not contain the afuwin.exe. Do I just download the latest from https://www.wimsbios.com/amiflasher.jsp? The particular one I am looking at contains AFUDOS.exe, AMIDEDOS, AUTOEXEC.BAT, changes.txt, ChgLogo.exe, CompDos.exe, flash2.exe, IMAGE9S.CAP, logo.bat, readme.txt. I have downloaded all the available firmware (ISO,ZIP,EXE) from https://support.lenovo.com/us/en/downloads/ds029265 and none seem to have the afuwin.exe.
Thanks

windowstechreply
2018-07-03 at 12:07
– In reply to: Mike Niccum

Hi Mike
Thanks for commenting! I just chose the one called “Flash UEFI BIOS update (Flash from operating system version)”. Here’s the link: https://download.lenovo.com/pccbbs/thinkcentre_bios/9sjy9ausa.exe. It contains both AFUWIN.EXE and AFUWINx64.EXE.
Br Peter

Rickyreply
2020-03-19 at 13:14

Hi, First let me say thank you, this solution works a treat on the laptops I’ve got, noticed you didn’t list any Desktops in your script, what should be the command to run for desktops, PerformUpdateDesktops, laptops have oWSHShell.Run “WINUPTP.EXE -s”,0,true but desktops just oWSHShell.Run StrCommand,0,true

windowstechreply
2020-05-05 at 10:31
– In reply to: Ricky

Hi Ricky
Sorry for the late reply. There are a few desktops in the script, e.g. M92P. The command for desktops is specified as a parameter when calling the function. For the M92P model, it is “afuwin.exe image9s.cap /p /n /sp /q”.

Leave a reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.