MDT 2012 - Bios updates in a task sequence RRS feed

  • Question

  • I have based my bios update process on

    <cite class="iUh30">https://www.joseespitia.com/2017/01/30/automate-your-bios-update-in-mdt/</cite>

    I have been unable to get a response from the site, so I am reaching out to the forum. I can get the script to run, but when the flash command issued, and the pc reboots the pc does not get flashed. To me it seems that the Task Sequence is being executed outside of the operating system shell, and that is where the issue is (at least that is my guess).

    Here is the script, I have modified it a bit

    # Load MDT Task Sequence Environment and Logs
    $TSenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
    $logPath = $tsenv.Value("LogPath")
    $logFile = "$logPath\BIOS_Update.log"
    #Variable change
    $ScriptRoot = $PSScriptRoot

    # Start the logging
    Write-Output "Logging to $logFile." > $logFile
    # Added Additional Log details
    Write-Output "Using Rev1 Script" >> $logfile
    Write-Output "The current logpath $logPath" >> $logFile
    Write-Output "The current logfile $logFile " >> $logFile
    Write-Output "The current running directory ($Get-Location).Path" >> $logFile
    Write-Output "The Script Root location is: $ScriptRoot" >> $logFile
    Write-Output "The PSScriptRoot location is: $PSScriptRoot" >> $logFile

    # Collect data
    Write-Output "Collecting Data" >> $logFile
    $ScriptRoot = (Get-location).Path
    $Model = $TSenv.Value("Model")
    Write-Output "Model:$Model" >> $logfile
    $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 "$CurrentBiosVersion does not exist" >> $logFile
    # Checking for BIOS update
    if($CompBiosVersion.replace(' ' , '') -eq $CurrentBiosVersion.replace(' ' , '')) {
        Write-Output "BIOS is up to date." >> $logFile
    else {
         Write-Output "It looks like we need to update your bios From: $CompBiosVersion To: Bios: $CurrentBiosVersion. Now passing script over to: $ScriptRoot\$Model\$Installer." >> $logFile
         Start-Process "$ScriptRoot\$Model\$Installer" -Verb "runas" -Wait
        $tsenv.Value("NeedReboot") = "Yes"
        Write-Output "Update has been completed successfully." >> $logFile

    Here is the bios batch job... This I change too  as I couldn't get it to flash using the network, so I tried copying it local... the copy happens and the files are there but it never flashes.

    REM Setting Current Directory
    pushd "%~dp0"
    mkdir c:\swtools\flash
    xcopy /e *.* c:\swtools\flash
    cd /d c:\swtools\flash
    WINUPTP.exe -s

    The prior batch job I used was

    REM Setting Current Directory
    pushd "%~dp0"
    WINUPTP.exe -s

    along with the one mentioned in the post.... Any ideas on why the flash does not occur?

    Friday, May 25, 2018 5:50 PM

All replies

  • Does the BIOS update work when you run it manually via cmd? Personally I prefer Mikael Nystrom‘s script, but it is more a matter of personal taste.


    Vacuum Breather Blog | Wing Commander Saga | Twitter

    Note: Posts are provided "AS IS" without warranty of any kind. If posts are helpful please don't forget to rate them as "Helpful" or as "Answer".

    Friday, May 25, 2018 8:21 PM
  • Yes, it works if I run it via a command line.
    Thursday, May 31, 2018 12:08 PM