OSD 自动升级Dell BIOS 版本
1. 创建文件目录Latitude, 并为各个Laititude型号创建子目录,包存BIOS文件到各个子目录1
2. Latitude目录下创建额外3个文件
BIOS.txt - bios admin password,如果没有密码设置可以将内容留空
Flash64W.exe - Dell提供的WinPE下刷新BIOS应用
DellBiosUpgradePackage-2.0.ps1 - WinPE下刷新BIOS的Pws脚本,内容如下
$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执行升级脚本
结构如下,先创建一个group并添加condition - select * from Win32_ComputerSystem where Model like '%Latitude%'
为每个型号系列创建一个run command 并按照对应型号创建condition, 如latitude - select * from Win32_ComputerSystem where Model like '%Latitude%'
command line 一栏输入 powershell.exe -NoProfile -ExecutionPolicy ByPass -file .\DellBiosUpgradePackage-2.0.ps1
最后在group里添加一个Restart Computer,并创建condtion 为变量 SMSTS_BiosUpdateRebootRequired = True
脚本成功后会根据return code来修改变量 SMSTS_BiosUpdateRebootRequired 从而达到重启系统完成BIOS升级的目的。
页:
[1]