ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

OSD 自动升级Dell BIOS 版本

2021-03-16 15:52:41  阅读:243  来源: 互联网

标签:exe BIOS Get Dell Value OSD tsenv Bios SMSTS


1. 创建文件目录Latitude, 并为各个Laititude型号创建子目录,包存BIOS文件到各个子目录

1latitude.png














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%'

tasksequence.png






为每个型号系列创建一个run command 并按照对应型号创建condition, 如latitude - select * from Win32_ComputerSystem where Model like '%Latitude%'

command line 一栏输入 powershell.exe -NoProfile -ExecutionPolicy ByPass -file .\DellBiosUpgradePackage-2.0.ps1

ts-latitude.png













最后在group里添加一个Restart Computer,并创建condtion 为变量 SMSTS_BiosUpdateRebootRequired = True

脚本成功后会根据return code来修改变量 SMSTS_BiosUpdateRebootRequired 从而达到重启系统完成BIOS升级的目的。

image.png













标签:exe,BIOS,Get,Dell,Value,OSD,tsenv,Bios,SMSTS
来源: https://blog.51cto.com/sky2133/2661626

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有