OSD 自動升級Dell BIOS 版本

1. 建立文件目錄Latitude, 併爲各個Laititude型號建立子目錄,包存BIOS文件到各個子目錄ios

1latitude.pngshell














2. Latitude目錄下建立額外3個文件ide

BIOS.txt - bios admin password,若是沒有密碼設置能夠將內容留空ui

Flash64W.exe - Dell提供的WinPE下刷新BIOS應用this

DellBiosUpgradePackage-2.0.ps1 - WinPE下刷新BIOS的Pws腳本,內容以下spa

$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment -ErrorAction SilentlyContinue
$tsenv.Value("SMSTS_BiosUpdate") = "True"

#Create Log Path
$LogPath = $tsenv.Value("_SMSTSLogPath")

#Get Bios Password from File
$BiosPassword = Get-Content .\Bios.txt

#Create Model Variable
$ComputerModel = Get-WmiObject -Class Win32_computersystem | Select-Object -ExpandProperty Model

if (test-path ".\$ComputerModel\")
{

#Copy Bios Installer to the root of the package - the Flash64W didn't like when I left it in the Computer Model folder, because it has spaces. (Yes, I tried qoutes and stuff)
Copy-Item $ComputerModel\*.exe -Destination $PSScriptRoot

#Get Bios File Name (Uses the Bios EXE file in the same folder)
$BiosFileName = Get-ChildItem $ComputerModel\*.exe -Verbose | Select -ExpandProperty Name

#Get Bios File Name (No Extension, used to create Log File)
$BiosLogFileName = Get-ChildItem $ComputerModel\*.exe -Verbose | Select -ExpandProperty BaseName
$BiosLogFileName = "$BiosLogFileName.log"

#Set Arguments for Bios Update
$BiosArguments = "/s /p=$BiosPassword /l=$LogPath\$BiosLogFileName"

#Run Test Run - For some reason if I don't do this, I get odd error about can't read memory.. bla bla
start-process "$PSScriptRoot\Flash64W.exe" /"p=$BiosPassword /s"

#Update Bios
$Process = start-process "$PSScriptRoot\Flash64W.exe" /b="$PSScriptRoot\$BiosFileName $BiosArguments" -UseNewEnvironment -PassThru -wait

#Creates and Set TS Variable to be used to run additional steps if reboot requried.
if ($process.ExitCode -eq 2)
    {$tsenv.Value("SMSTS_BiosUpdateRebootRequired") = "True"}
    else
    {$tsenv.Value("SMSTS_BiosUpdateRebootRequired") = "False"}
if ($process.ExitCode -eq 10)
    {$tsenv.Value("SMSTS_BiosUpdateBatteryCharge") = "True"}
    else
    {$tsenv.Value("SMSTS_BiosUpdateBatteryCharge") = "False"}
}


3. 建立TaskSequence執行升級腳本code

結構以下,先建立一個group並添加condition - select * from Win32_ComputerSystem where Model like '%Latitude%'blog

tasksequence.png






爲每一個型號系列建立一個run command 並按照對應型號建立condition, 如latitude - select * from Win32_ComputerSystem where Model like '%Latitude%'ip

command line 一欄輸入 powershell.exe -NoProfile -ExecutionPolicy ByPass -file .\DellBiosUpgradePackage-2.0.ps1get

ts-latitude.png













最後在group裏添加一個Restart Computer,並建立condtion 爲變量 SMSTS_BiosUpdateRebootRequired = True

腳本成功後會根據return code來修改變量 SMSTS_BiosUpdateRebootRequired 從而達到重啓系統完成BIOS升級的目的。

image.png

相關文章
相關標籤/搜索