安全启动 E2E 自动化指南示例
应用对象
原始发布日期: 2026 年 3 月 16 日
KB ID:5084567
本文内容
概述
本指南介绍使用组策略和渐进式推出波次更新 Windows Secure Boot DB 证书的自动部署系统。
安全启动证书推出自动化是基于 PowerShell 的系统,它以受控的分级方式将 Windows Secure Boot DB 证书更新部署到已加入域的计算机。
关键功能
|
功能 |
描述 |
|
分级推出 |
1 > 2 > 4 > 8... 每个存储桶的设备数 |
|
自动阻止 |
排除具有无法访问设备的存储桶 |
|
自动 GPO 部署 |
单个业务流程协调程序脚本处理所有内容 |
|
计划任务执行 |
无需交互式提示 |
|
实时监视 |
带有进度栏的状态查看器 |
证书汇报设置参考
在本节中
AvailableUpdatesPolicy 组策略
|
注册表位置 |
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecureBoot |
|
名称 |
AvailableUpdatesPolicy |
|
值 |
0x5944 (DWORD) |
这是 GPO/ADMX 控制的密钥,可:
-
在重新启动时保留
-
由 组策略/MDM 设置
-
不会导致重试循环 (通过 ClearRolloutFlags) 清除
-
策略驱动部署的正确密钥
WinCSFlags - Windows 配置系统标志
域管理员可以使用随 Windows OS 更新一起发布的 Windows 配置系统 (WinCS) 跨已加入域的 Windows 客户端和服务器部署安全启动更新。 它包含命令行 接口 (CLI) 实用工具 ,用于在本地查询安全启动配置并将其应用于计算机。
|
功能名称 |
WinCS 密钥 |
描述 |
|
Feature_AllKeysAndBootMgrByWinCS |
F33E0C8E002 |
启用此密钥可在设备上安装以下Microsoft提供的安全启动新证书。
|
架构版
阶段 1:企业级别的检测和状态监视
在本节中
阶段 1 所需的脚本
安全启动清单数据收集脚本示例
|
示例脚本名称 |
用途 |
运行在 |
|
收集设备状态数据 |
每个终结点通过 GPO) ( |
|
|
生成报表和仪表板 |
管理员工作站 |
|
|
自动创建用于数据收集的 GPO |
域控制器 |
本地测试
在通过 GPO 进行部署之前,请在单台计算机上测试收集脚本以验证功能。
-
在本地运行集合脚本 打开提升的 PowerShell 提示符并执行:
& .\Detect-SecureBootCertUpdateStatus.ps1 -OutputPath “C:\Temp\SecureBootTest”
-
验证 JSON 输出
# View the collected data Get-Content“C:\Temp\SecureBootTest\*_latest.json” |ConvertFrom-Json |Format-List
要验证 的键字段 • SecureBootEnabled - 应为 True 或 False • OverallStatus – Complete、ReadyForUpdate、NeedsData 或 Error • BucketHash - 用于置信度数据匹配的设备存储桶 • SecureBootTaskEnabled - 显示安全启动更新任务的状态。
-
测试聚合脚本
# Generate reports from collected data & .\Aggregate-SecureBootCertStatus.ps1” -InputPath “C:\Temp\SecureBootTest” ' -OutputPath “C:\Temp\SecureBootReports” # 打开 HTML 仪表板
Start-Process "C:\Temp\SecureBootReports\SecureBoot_Dashboard_*.html"
GPO 部署
使用从域控制器提供的自动化脚本:
# 作为交互式 OU 节的域管理员在域控制器上运行 - 建议 # 将“Contoso.com”、“Contoso”替换为域的名称 # 将 FILESERVER 替换为文件服务器名称。 脚本显示要部署 GPO 的 OU 列表 .\Deploy-GPO-SecureBootCollection.ps1 ' -DomainName “contoso.com” -AutoDetectOU ' -CollectionSharePath “\\FILESERVER\SecureBootLogs$” ' -ScriptSourcePath “.\Detect-SecureBootCertUpdateStatus.ps1” ' -Schedule “Daily” ' -ScheduleTime “14:00” ' -RandomDelayHours 4
此脚本将执行以下操作:
-
使用指定名称创建新的 GPO
-
将集合脚本复制到 SYSVOL 以实现高可用性
-
配置计算机启动脚本
-
将 GPO 链接到目标 OU
-
(可选)为定期收集创建计划任务
下表提供了基于队列大小的延迟时长的指导。
|
机群大小 |
延迟范围 |
|
1-10K 台设备 |
4 小时 |
|
10K-50K 设备 |
8 小时 |
|
50K+ 台设备 |
12-24 小时 |
GPO 设置摘要
|
Setting |
位置 |
值 |
|
启动脚本 |
计算机配置→脚本 |
Detect-SecureBootCertUpdateStatus.ps1 |
|
脚本参数 |
(相同的) |
-OutputPath “\\server\share$” |
|
执行策略 |
PowerShell →计算机配置→ 管理员模板 |
允许本地和远程签名 |
|
计划任务 |
计算机配置→首选项→计划任务 |
每日/每周集合 |
验证
-
在测试加工 e 上强制更新 GPO
## On a test workstation gpupdate /force # 重新启动客户端计算机以启动脚本,否则将在下一个计划触发。 Restart-Computer -Force
-
验证数据收集
# 检查是否 (文件服务器或任何计算机) 收集数据 Get-ChildItem“\\fileserver\SecureBootData$”| Sort-Object LastWriteTime -Descending | Select-Object -First 10 # 验证 JSON 内容 Get-Content“\\fileserver\SecureBootData$\TESTPC_latest.json”|ConvertFrom-Json
-
检查 GPO 应用程序
# 验证 GPO 是否已应用于计算机 gpresult /r /scope:computer |Select-String“SecureBoot” s 该脚本还会保存本地副本,以便实现冗余: Get-ChildItem“C:\ProgramData\SecureBootCollection\”
阶段 2:安全启动证书更新业务流程脚本
重要: 确保阶段 1 已完成,包括每个终结点上的数据收集到远程服务器共享。
在本节中
阶段 2 所需的脚本
安全启动清单数据收集脚本示例
|
示例脚本名称 |
用途 |
运行在 |
|
收集设备状态数据 |
每个终结点通过 GPO) ( |
|
|
生成报表和仪表板 |
管理员工作站 |
|
|
自动创建用于数据收集的 GPO |
域控制器 |
|
|
使用自动 GPO 部署实现证书安装的完全自动化、连续的业务流程 |
管理员工作站 |
|
|
将 Orchestrator 脚本部署为计划任务,以便自动推出 |
域控制器 |
|
|
从任何工作站查看安全启动证书推出状态 |
管理员工作站 |
|
|
启用安全启动更新任务 |
在禁用任务的终结点上, (仅运行一次以启用任务(如果禁用) |
Start-SecureBootRolloutOrchestrator.ps1
-
目的: 使用自动 GPO 部署实现完全自动化的连续业务流程。
-
它的作用
-
设备状态的调用 Aggregate-SecureBootData.ps1
-
使用渐进式翻倍生成推出波
-
使用以下方法之一创建用于证书部署的 GPO
-
安全启动组策略 AvailableUpdatesPolicy = 0x5944 (默认)
-
WinCS 方法 (参数 – UseWinCS)
-
-
创建用于目标的 AD 安全组
-
将计算机帐户添加到安全组
-
配置 GPO 安全筛选
-
将 GPO 链接到目标 OU
-
监视阻止的存储桶 (无法访问的设备)
-
设备恢复时自动取消阻止
-
-
使用情况
# Interactive (testing) .\Start-SecureBootRolloutOrchestrator.ps1 ' -AggregationInputPath “\\fileserver\SecureBootData$” ' -ReportBasePath “C:\SecureBootReports” ' -PollIntervalMinutes 30
# Interactive (testing), leveraging WinCS method .\Start-SecureBootRolloutOrchestrator.ps1 ' -AggregationInputPath “\\fileserver\SecureBootData$” ' -ReportBasePath “C:\SecureBootReports” ' -PollIntervalMinutes 1440 -UseWinCS
-
管理员命令
# List blocked buckets .\Start-SecureBootRolloutOrchestrator.ps1 -ReportBasePath “C:\SecureBootReports” -ListBlockedBuckets
# Unblock specific bucket .\Start-SecureBootRolloutOrchestrator.ps1 -ReportBasePath “C:\SecureBootReports” -UnblockBucket “Dell|Latitude5520 |BIOS1.2”
# Unblock all .\Start-SecureBootRolloutOrchestrator.ps1 -ReportBasePath “C:\SecureBootReports” -UnblockAll
-
参数
参数
默认为
描述
AggregationInputPath
必选
终结点 JSON 文件的 UNC 路径
ReportBasePath
必选
报表和状态的本地路径
TargetOU
域根
用于链接 GPO 的 OU
WavePrefix
SecureBoot-Rollout
GPO/组命名前缀
MaxWaitHours
72
检查设备可访问性前的小时数
PollIntervalMinutes
1440
状态检查之间的分钟数
DryRun
否
显示在没有更改的情况下将发生的情况
Deploy-OrchestratorTask.ps1
-
目的: 将业务流程协调程序部署为 Windows 计划任务。
-
权益
-
没有 PowerShell 安全提示 (ExecutionPolicy 绕过)
-
在后台连续运行
-
无需用户交互
-
在重新启动后幸存下来
-
-
使用情况
-
使用域服务帐户进行部署 (建议)
-
使用 AvailableUpdates 组策略 (默认方法)
.\Deploy-OrchestratorTask.ps1 ' -AggregationInputPath “\\server\SecureBootData$” ' -ReportBasePath “C:\SecureBootReports” ' -ServiceAccount“DOMAIN\svc_secureboot”
-
使用 WinCS 方法
.\Deploy-OrchestratorTask.ps1 ' -AggregationInputPath “\\server\SecureBootData$” ' -ReportBasePath “C:\SecureBootReports” ' -ServiceAccount “DOMAIN\svc_secureboot” -UseWinCS
-
-
使用 SYSTEM 帐户进行部署
-
使用 AvailableUpdates 组策略 (默认方法)
.\Deploy-OrchestratorTask.ps1 ' -AggregationInputPath “\\server\SecureBootData$” ' -ReportBasePath “C:\SecureBootReports”
-
使用 WinCS method.\Deploy-OrchestratorTask.ps1
-AggregationInputPath “\\server\SecureBootData$” ' -ReportBasePath “C:\SecureBootReports” -UseWinCS
-
服务帐户要求
-
New-GPO、New-ADGroup、Add-ADGroupMember) 的域管理员 (
-
对 JSON 文件共享的读取访问权限
-
对 ReportBasePath 的写入访问权限
-
-
-
Get-SecureBootRolloutStatus.ps1
-
目的: 查看任何工作站的推出进度。
-
显示的内容
-
计划任务状态 (正在运行/就绪/已停止)
-
当前波形号
-
面向的设备与更新的设备
-
视觉进度栏
-
阻止的存储桶摘要
-
链接到最新的 HTML 仪表板
-
-
使用情况
# Quick status check .\Get-SecureBootRolloutStatus.ps1 -ReportBasePath “C:\SecureBootReports”
# Continuous monitoring (refreshes every 30 seconds) .\Get-SecureBootRolloutStatus.ps1 -ReportBasePath “C:\SecureBootReports” -Watch 30
# View blocked buckets .\Get-SecureBootRolloutStatus.ps1 -ReportBasePath “C:\SecureBootReports” -ShowBlocked
# View wave history .\Get-SecureBootRolloutStatus.ps1 -ReportBasePath “C:\SecureBootReports” -ShowWaves
# View recent log .\Get-SecureBootRolloutStatus.ps1 -ReportBasePath “C:\SecureBootReports” -ShowLog
# Open dashboard in browser .\Get-SecureBootRolloutStatus.ps1 -ReportBasePath “C:\SecureBootReports” -OpenDashboard
-
示例输出
============================================================== 安全启动推出状态 2026-02-17 19:30:00 ======================================================
Scheduled Task: Running
ROLLOUT PROGRESS ---------------------------------------- 状态:InProgress 当前波形:5 目标总数:1250 更新总数: 847
Progress: [█████████████████████░░░░░░░░░░░░░░░░░░░] 67.8%
BLOCKED BUCKETS: 2 buckets need attention 使用 -ShowBlocked 运行了解详细信息
LATEST DASHBOARD C:\SecureBootReports\Aggregation_20260217_193000\SecureBoot_Dashboard.html __________________________________________________________________________________________
E2E 部署步骤 (快速参考指南)
在本节中
阶段 1:检测基础结构
-
步骤 1:创建集合共享
# On file server $sharePath = “D:\SecureBootData” New-Item -ItemType 目录 -Path $sharePath -Force New-SmbShare -Name “SecureBootData$” -Path $sharePath -FullAccess “域管理员” -ChangeAccess “域计算机”
# Set NTFS permissions $acl = Get-Acl $sharePath $rule = New-Object System.Security.AccessControl.FileSystemAccessRule (“域计算机”,“修改”,“允许”) $acl。AddAccessRule ($rule) Set-Acl $sharePath $acl
-
步骤 2:部署检测 GPO
.\Deploy-GPO-SecureBootCollection.ps1 ` -DomainName “contoso.com” ' -OUPath “OU=Workstations,DC=contoso,DC=com” ' -CollectionSharePath “\\server\SecureBootData$”
-
步骤 3:等待终结点报告 (24-48 小时)
# 检查收集进度 (Get-ChildItem “\\server\SecureBootData$” -Filter “*.json”) 。计数
阶段 2:精心安排的推出
-
步骤 4:先决条件检查
-
检测 gpo 部署 (步骤 2)
-
至少 50 多个终结点报告 JSON
-
具有域管理员权限的服务帐户
-
使用 PowerShell 5.1+ 的管理服务器
-
-
步骤 5:将 Orchestrator 部署为计划任务
.\Deploy-OrchestratorTask.ps1 ` -AggregationInputPath “\\server\SecureBootData$” ' -ReportBasePath “C:\SecureBootReports” ' -ServiceAccount“DOMAIN\svc_secureboot”
-
步骤 6:监视进度
.\Get-SecureBootRolloutStatus.ps1 -ReportBasePath "C:\SecureBootReports"
-
步骤 7:查看仪表板
.\Get-SecureBootRolloutStatus.ps1 -ReportBasePath "C:\SecureBootReports" -OpenDashboard
-
步骤 8:管理阻止的存储桶
# List blocked .\Start-SecureBootRolloutOrchestrator.ps1 -ReportBasePath “C:\SecureBootReports” -ListBlockedBuckets
# Investigate and unblock .\Start-SecureBootRolloutOrchestrator.ps1 -ReportBasePath “C:\SecureBootReports” -UnblockBucket “Manufacturer|模型 |BIOS”
-
步骤 9:验证完成
.\Get-SecureBootRolloutStatus.ps1 -ReportBasePath "C:\SecureBootReports" # 状态应显示“已完成”
状态Files
业务流程协调程序维护 ReportBasePath\RolloutState\:
|
文件 |
描述 |
|
RolloutState.json |
波形历史记录、目标设备、状态 |
|
BlockedBuckets.json |
需要调查的存储桶 |
|
DeviceHistory.json |
按主机名进行设备跟踪 |
|
Orchestrator_YYYYMMDD.log |
每日活动日志 |
疑难解答
在本节中
业务流程协调程序未进行
-
检查计划的任务
Get-ScheduledTask -TaskName "SecureBoot-Rollout-Orchestrator"
-
检查日志
Get-Content "C:\SecureBootReports\RolloutState\Orchestrator_*.log" -Tail 50
-
验证 JSON 数据新鲜度
(Get-ChildItem "\\server\SecureBootData$" -Filter "*.json" | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-1) }).Count
阻止的存储桶
-
列表已阻止。
.\Start-SecureBootRolloutOrchestrator.ps1 -ReportBasePath "C:\SecureBootReports" -ListBlockedBuckets
-
调查设备可访问性。
-
检查固件问题。
-
调查后解除阻止。
GPO 未应用
-
验证 GPO 是否存在。
Get-GPO -Name "SecureBoot-Rollout-Wave*"
-
检查安全筛选。
Get-GPPermission -Name "GPO-Name" -All
-
验证计算机是否在安全组中。
-
在目标上应用 GPO。
gpupdate /force