1. 文档目的本文档旨在介绍基于 PowerShell 图形化工具GUI的解决方案用于将 OEM 设备驱动程序集成至 Windows 安装 ISO 映像中以提升 Windows 在特定硬件平台包括 OEM 定制设备及 Windows on ARM 平台上的部署兼容性。该方法适用于需要在 Windows 安装阶段Setup / WinPE / OOBE 提前加载硬件驱动的企业级部署场景。2. 适用场景本文档适用于以下典型部署场景OEM 或企业 IT 团队在 Windows 部署前需要预先集成以下类型驱动芯片组驱动存储、网络、USB等平台相关驱动Windows on ARMARM64专用驱动使用标准 Windows ISO 在目标硬件平台上部署时出现存储设备无法识别网络设备缺失安装阶段设备不完整等问题希望通过图形化方式降低传统 DISM命令行操作的复杂度和使用门槛3. 概述本方案基于一个 PowerShell 图形化集成工具对 Windows ISO 映像执行自动化处理包括挂载指定的 Windows 安装ISO加载并处理关键映像文件如 install.wim / boot.wim批量注入指定路径下的 OEM 驱动提交变更并重新生成可用于部署的 Windows ISO整个过程通过图形化界面完成无需用户手动执行复杂的 DISM 命令。4. 支持的 Windows 映像范围Windows 11ARM64 架构具体取决于所使用的驱动包标准 Microsoft 官方 Windows ISO注意驱动架构必须与目标 Windows 映像架构完全一致如 ARM64驱动仅可注入ARM64映像。5. 准备工作在开始操作前请准备以下内容Windows ISOOEM 驱动包已解压的驱动文件夹驱动需包含标准 .inf 描述文件6. 操作流程6.1 准备脚本文件将以下PowerShell 脚本保存至本地目录 例如D:\InjectOEMDriversToWinISO.ps1Add-Type -AssemblyName System.Windows.FormsAdd-Type -AssemblyName System.Drawing$form New-Object System.Windows.Forms.Form$form.Text ISO Generator Tool$form.Size New-Object System.Drawing.Size(500,300)$form.StartPosition CenterScreen$button New-Object System.Windows.Forms.Button$button.Text Generate New ISO$button.Size New-Object System.Drawing.Size(200,40)$button.Location New-Object System.Drawing.Point(150,200)$statusLabel New-Object System.Windows.Forms.Label$statusLabel.Size New-Object System.Drawing.Size(450,20)$statusLabel.Location New-Object System.Drawing.Point(25,20)$statusLabel.Text Status: Waiting for user action$progressBar New-Object System.Windows.Forms.ProgressBar$progressBar.Location New-Object System.Drawing.Point(25,50)$progressBar.Size New-Object System.Drawing.Size(450,20)$progressBar.Minimum 0$progressBar.Maximum 100$progressBar.Value 0$button.Add_Click({try {# Step 1: Select ISO file$statusLabel.Text Step 1: Select ISO file$openFileDialog New-Object System.Windows.Forms.OpenFileDialog$openFileDialog.Filter ISO files (*.iso)|*.isoif ($openFileDialog.ShowDialog() -ne OK) { return }$isoPath $openFileDialog.FileNameStart-Sleep -Seconds 1$progressBar.Value 10# Step 2: Select driver folder$statusLabel.Text Step 2: Select driver folder$folderBrowser New-Object System.Windows.Forms.FolderBrowserDialog$folderBrowser.Description Select driver folder (for injection)if ($folderBrowser.ShowDialog() -ne OK) { return }$driverPath $folderBrowser.SelectedPathStart-Sleep -Seconds 1$progressBar.Value 20# Step 3: Create working directory$statusLabel.Text Step 3: Create working directory$extractPath C:\ISO\Win1124H2if (Test-Path $extractPath) { Remove-Item -Recurse -Force $extractPath }New-Item -ItemType Directory -Path $extractPath -Force | Out-NullStart-Sleep -Seconds 1$progressBar.Value 30# Step 4: Extract ISO using 7-Zip$statusLabel.Text Step 4: Extract ISO$sevenZip C:\Program Files\7-Zip\7z.exeif (!(Test-Path $sevenZip)) {[System.Windows.Forms.MessageBox]::Show(7-Zip not found at $sevenZip, Error, [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)return}Start-Process -FilePath $sevenZip -ArgumentList x $isoPath -o$extractPath -y -WaitStart-Sleep -Seconds 1$progressBar.Value 40# Step 5: Inject drivers using DISM$statusLabel.Text Step 5: Inject drivers$mountPath C:\ISO\Mountif (Test-Path $mountPath) { Remove-Item -Recurse -Force $mountPath }New-Item -ItemType Directory -Path $mountPath -Force | Out-Nulldism /Cleanup-Wim | Out-Null# Inject into boot.wim$bootWim $extractPath\sources\boot.wimif (Test-Path $bootWim) {$bootIndexes (dism /Get-WimInfo /WimFile:$bootWim | Select-String Index :).Countfor ($i1; $i -le $bootIndexes; $i) {try {$statusLabel.Text Mounting boot.wim Index $idism /Mount-Wim /WimFile:$bootWim /Index:$i /MountDir:$mountPath | Out-Null$statusLabel.Text Injecting drivers to boot.wim Index $i$injectResult dism /Image:$mountPath /Add-Driver /Driver:$driverPath /Recurse[System.Windows.Forms.MessageBox]::Show(boot.wim Index $i injection result:n$injectResult, DISM Output, [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)$statusLabel.Text Committing boot.wim Index $idism /Unmount-Wim /MountDir:$mountPath /Commit | Out-Null} catch {$errMsg $_ | Out-String[System.Windows.Forms.MessageBox]::Show((Error injecting boot.wim Index {0}: {1} -f $i, $errMsg), Error, [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)}}}# Inject into install.wim$installWim $extractPath\sources\install.wimif (Test-Path $installWim) {$installIndexes (dism /Get-WimInfo /WimFile:$installWim | Select-String Index :).Countfor ($i1; $i -le $installIndexes; $i) {try {$statusLabel.Text Mounting install.wim Index $idism /Mount-Wim /WimFile:$installWim /Index:$i /MountDir:$mountPath | Out-Null$statusLabel.Text Injecting drivers to install.wim Index $i$injectResult dism /Image:$mountPath /Add-Driver /Driver:$driverPath /Recurse[System.Windows.Forms.MessageBox]::Show(install.wim Index $i injection result:n$injectResult, DISM Output, [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)$statusLabel.Text Committing install.wim Index $idism /Unmount-Wim /MountDir:$mountPath /Commit | Out-Null} catch {$errMsg $_ | Out-String[System.Windows.Forms.MessageBox]::Show((Error injecting install.wim Index {0}: {1} -f $i, $errMsg), Error, [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)}}}Start-Sleep -Seconds 1$progressBar.Value 60# Step 6: Split install.wim$statusLabel.Text Step 6: Split install.wim$swmPath $extractPath\sourcesStart-Process -FilePath dism.exe -ArgumentList /Split-Image /ImageFile:$installWim /SWMFile:$swmPath\install.swm /FileSize:3800 -WaitStart-Sleep -Seconds 1$progressBar.Value 70# Step 7: Delete install.wim$statusLabel.Text Step 7: Delete install.wimRemove-Item $installWim -ForceStart-Sleep -Seconds 1$progressBar.Value 80# Step 8: Rebuild ISO using oscdimg$statusLabel.Text Step 8: Rebuild ISO$bootFile $extractPath\boot\etfsboot.com$newIso C:\ISO\NewWin11.iso$oscdimg C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\oscdimg.exeStart-Process -FilePath $oscdimg -ArgumentList -b$bootFile $extractPath $newIso -u2 -m -WaitStart-Sleep -Seconds 1$progressBar.Value 100[System.Windows.Forms.MessageBox]::Show(New ISO file has been successfully created., Success, [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)}catch {$errMsg $_ | Out-String[System.Windows.Forms.MessageBox]::Show((An error occurred: {0} -f $errMsg), Error, [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)}})$form.Controls.Add($button)$form.Controls.Add($statusLabel)$form.Controls.Add($progressBar)$form.ShowDialog()6.2 以管理员身份运行Power Shell,执行以下命令powershell -executionpolicy bypass -file.\InjectOEMDriversToWinISO.ps16.3 启动工具并生成ISO点击”Generate New ISO”,6.4. 选择Windows 安装ISO文件6.5 选择OEM驱动包所在目录6.6 点击Ok, 工具将自动完成驱动注入和映像封装的流程6.7 驱动注入与映像封装自动过程在上述步骤完成后工具将自动执行以下操作驱动注入扫描指定的 OEM 驱动目录基于Windows 官方映像服务机制DISM注入受支持的驱动映像封装提交映像变更卸载映像生成包含 OEM 驱动的 Windows 安装ISO 默认输出路径为C:\ISO7. 结论通过 PowerShell 图形化驱动集成工具可以在不增加部署复杂度的前提下有效提升 Windows 安装映像在特定硬件平台上的兼容性与部署成功率。该方法特别适合需要支持 OEM 定制硬件及 Windows on ARM 平台 的企业级Windows部署场景。