none
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
        Stop-Transcript
        Exit
    }
    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
        Exit
    }

    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"
    pause
    mkdir c:\swtools\flash
    xcopy /e *.* c:\swtools\flash
    popd
    cd /d c:\swtools\flash
    pause
    WINUPTP.exe -s

    The prior batch job I used was

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

    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