New question about BIOS upgrade in MDT TS.

Rick Someone 411 Reputation points
2022-02-04T15:16:29.687+00:00

I'm asking a similar question as I have recently, because most of it I have sorted out.

I'm upgrading the BIOS on three different models of Panasonic. I have a text file for each, containing the newest version
each model should be at.

There is a Run Check BIOS job that checks the version in the text file, and a WMI that says if the bios is not like the text version, run the exe associated to that model.
Then, I added a reboot. And the restart has a condition that says, TS variable NeedReboot=YES, then the pc will reboot.

The issue I'm having is that if I image, say, CF33-1, the CF33-1 check BIOS will run, sees if it matches or not, and even if it matches, there is a reboot. I don't know the proper logic to tell it to reboot ONLY if it had to run the exe update.
I know for a fact that you need a reboot step in MDT to control the reboot or the TS breaks. But I only need it to reboot if the bios gets updated.

Windows for business | Windows Client for IT Pros | Devices and deployment | Set up, install, or upgrade
0 comments No comments
{count} votes

10 answers

Sort by: Most helpful
  1. Rick Someone 411 Reputation points
    2022-02-17T15:25:44.73+00:00

    I figured the best way to go is with one of the two links I posted.....

    https://supportishere.com/installing-panasonic-toughbook-bios-updates-in-a-task-sequence/

    There were a few extra things to add. When the BIOS is not the highest, it gets upgraded and a restart occurs, then the
    TS continues on.
    If the BIOS is the current version, for one model, my Check BIOS merely says:

    SELECT * FROM Win32_Bios WHERE NOT SMBIOSBIOSVersion LIKE "V100L26"

    then the install/restart happens.

    In the case where it checks the version when it does match, it still tries to install the BIOS, does a restart, and at the end
    of the TS I get one error, Code 300, which means the version already is installed.
    So rather than spend any more time on wondering why it installs when its already there, I gave the installer an exception code of 300.
    At the end of the whole TS, its a white screen with no errors or warnings.
    Thank you for all of your input and suggestion!

    1 person found this answer helpful.
    0 comments No comments

  2. AlexZhu-MSFT 6,591 Reputation points Moderator
    2022-02-07T08:42:27.707+00:00

    Hi,

    If I understand correctly, we are wondering when the TS variable NeedReboot is changed to YES so that we can finetune the logic in TS. Yes, you're correct, a reboot task is required prior to using the new version BIOS. Commonly, the value is set to YES when a BIOS upgrade progrom is executed and the reboot is suppressed so that a consiquent reboot task is taken place to contine the TS without any breaking (hook is generated before rebooting)

    To find out how this variable changes, we may use the MDT TS debugger documented in this article and the download link is as following:

    https://github.com/damienvanrobaeys/MDT-Task-Sequence-Debugger
    Note: this information above is just for your reference.

    Alex

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. AlexZhu-MSFT 6,591 Reputation points Moderator
    2022-02-08T08:34:41.623+00:00

    Hi,

    Thank you very much for the reply.

    MDT and BIOS Upgrade.
    https://learn.microsoft.com/en-us/answers/questions/709413/mdt-and-bios-upgrade.html

    I've read the above related thread and gotten some information. I think the logic is as below:

    get the current version and compare with the .txt file
    if (the current version is not the newest )
    {
    execute the upgrade BIOS prograss, set NeedReboot to Yes, and the reboot is suppressed
    }
    reboot if NeedReboot is set to Yes

    For debugging, we can manually execute the following example cmdlets to simulate the logic. Or, the script you've provided (bios-check.ps1) will log information to BIOS_Update.log, could you share this log for further analysis?

    $CompBiosVersion = (Get-WmiObject WIN32_BIOS).SMBIOSBIOSVersion
    $CurrentBiosVersion = Get-Content "\\10.1.1.2\d\alex\bios.txt"
    $CompBiosVersion
    $CurrentBiosVersion
    if ($CompBiosVersion.replace(' ' , '') -eq $CurrentBiosVersion.replace(' ' , ''))
    {
    write-host "BIOS is up to date."
    }

    example output screenshot (even though there is an extra space character, the versions match)
    172050-mdt-check-bios-version.png

    the script you shared before:

    # Load MDT Task Sequence Environment and Logs  
    $TSenv = New-Object -COMObject Microsoft.SMS.TSEnvironment  
    $logPath = $tsenv.Value("LogPath")  
    $logFile = "$logPath\BIOS_Update.log"  
        
    # Start the logging   
        
    Write-Output "Logging to $logFile." > $logFile  
        
    # Collect data  
    Write-Output "Collecting Data" >> $logFile  
    $ScriptRoot = (Get-location).Path  
    $Model = $TSenv.Value("Model")  
    $CompBiosVersion = (Get-WmiObject WIN32_BIOS).SMBIOSBIOSVersion  
    $CurrentBiosVersion = Get-Content "$ScriptRoot\$Model\BIOS.txt"  
    $Installer = "UpgradeBIOS.cmd"  
       
    try {  
        Test-Path $CurrentBiosVersion -ErrorAction Stop  
    }  
    catch {  
        Write-Output "BIOS.txt does not exist!" >> $logFile  
    }  
       
    Write-Output "Copying $ScriptRoot\$Model to C:\Temp\$Model" >> $logFile  
    Copy-Item "$ScriptRoot\$Model" "C:\Temp\$Model" -Force -Recurse  
        
    # Checking for BIOS update  
    if($CompBiosVersion.replace(' ' , '') -eq $CurrentBiosVersion.replace(' ' , '')) {  
        Write-Output "BIOS is up to date." >> $logFile  
        Exit  
    }  
    else {  
        Write-Output "Updating BIOS $CompBiosVersion to $CurrentBiosVersion." >> $logFile  
        Start-Process "cmd.exe" "/c C:\Temp\$Model\$Installer" -Wait  
        $tsenv.Value("NeedReboot") = "YES"  
        Write-Output "Update has been completed successfully." >> $logFile  
        Exit  
    }  
    

    Alex

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  4. AlexZhu-MSFT 6,591 Reputation points Moderator
    2022-02-09T07:51:05.51+00:00

    Hi,

    Thank you for the valuable input. Yes, we are talking about the same thing. Please understand that we don't have the exact environment for testing. Guess the script is for task (1), right?

    From line 29 to line 32, if the version match, the Restart Computer (2) task will be skipped (since NeedReboot isn't set to YES) and the TS will move to next group Configure BIOS 2.

    And the suituation is: the Restart Computer (2) task was not skipped, right? So, we suggest to track when the variable NeedReboot is changed (as mentioned above). The short eight-line cmdlets are just to manually test to see if the logic is correct. If possible, you may test in your environment and share the result.

    Currently, we can add one line to output the variable value to the log file and share the log file to see if there is any clue

    # Checking for BIOS update  
    if($CompBiosVersion.replace(' ' , '') -eq $CurrentBiosVersion.replace(' ' , '')) {  
        Write-Output "BIOS is up to date." >> $logFile  
        $tsenv.Value("NeedReboot") >> $logFile  
        Exit  
    }  
    

    172486-171941-biosreboot.jpg

    Regards
    Alex

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  5. AlexZhu-MSFT 6,591 Reputation points Moderator
    2022-02-10T04:07:46.677+00:00

    Hi,

    I have read through both the two threads for several times. It seems we missed the actual screenshots (not shown correctly) and script in the actual environment. I suppose the right structure of TS is as below:

    172986-mdt-02.png

    Note: (1) the folder only groups the tasks and it never do the selection so we encounter multiple reboots currently
    (2) please change the TS as listed above and try again, if any problem is encountered, please share the script in BIOS Check and Upgrade task for further debugging.

    not shown correctly image
    173014-mdt-01.png

    Regards
    Alex

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    https://learn.microsoft.com/en-us/answers/articles/67444/email-notifications.html

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.