安全開機端對點自動化指南範例
Applies To
原始出版日期: 2026年3月16日
KB ID:5084567
本文內容
概觀
本指南說明了使用 群組原則及漸進式部署波次,自動部署 Windows 安全開機資料庫憑證更新系統。
安全開機憑證推出自動化是一個基於 PowerShell 的系統,能以受控且漸進的方式部署 Windows 安全啟動資料庫憑證更新至已加入網域的機器。
主要特色
|
功能 |
描述 |
|
漸進式推廣 |
1 > 2 > 4 > 8...... 每個桶的裝置數 |
|
自動阻擋 |
無法存取裝置的桶被排除 |
|
自動化 GPO 部署 |
單一 orchestrator 腳本能處理所有事情 |
|
排程任務執行 |
不需要互動提示 |
|
即時監控 |
狀態檢視器與進度條 |
憑證匯報設定參考
在本節中
AvailableUpdatesPolicy 群組政策
|
登錄位置 |
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecureBoot |
|
姓名 |
可取得更新政策 |
|
值 |
0x5944 (DWORD) |
這是由 GPO/ADMX 控制的金鑰,內容如下:
-
重啟後依然存在
-
是由群組原則/MDM 設定的
-
不會導致重試迴圈, (透過 ClearRolloutFlags 清除)
-
是政策驅動部署的正確金鑰嗎?
WinCSFlags - Windows 配置系統旗標
網域管理員也可以選擇使用 Windows 作業系統更新 (Windows) 的 Windows 組態系統 ,將安全開機更新部署於已加入網域的 Windows 用戶端與伺服器之間。 它包含 命令列介面 (CLI) 工具 ,用於查詢並套用安全開機設定至本地機器。
|
功能名稱 |
WinCS 金鑰 |
描述 |
|
Feature_AllKeysAndBootMgrByWinCS |
F33E0C8E002 |
啟用此金鑰後,可在您的裝置上安裝以下 Microsoft 提供的安全開機新憑證。
|
Architecture
第一階段:企業層級的偵測與狀態監控
在本節中
第一階段所需腳本
安全啟動庫存資料收集腳本範例
|
範例劇本名稱 |
目的 |
繼續奔跑 |
|
收集裝置狀態資料 |
每個端點都透過 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 – 應為真或假 • 整體狀態 – 完成、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 -網域名稱「contoso.com」 -自動偵測 -CollectionSharePath 「\\FILESERVER\SecureBootLogs$」 -ScriptSourcePath “.\Detect-SecureBootCertUpdateStatus.ps1” ' -排程「每日」 -行程時間「14:00」 -隨機延遲 4
此腳本將執行以下操作:
-
建立指定名稱的新 GPO
-
將收集腳本複製到 SYSVOL 以達到高可用性
-
配置電腦啟動腳本
-
連結 GPO 與目標 OU
-
可選擇性地建立排程任務以供定期收集
下表根據您的車隊規模,提供延遲時間的指引。
|
機隊規模 |
延遲範圍 |
|
1-10K 裝置 |
4 小時 |
|
10K-50K 裝置 |
8 小時 |
|
50K+ 裝置 |
12-24小時 |
GPO 設定摘要
|
設定 |
位置 |
值 |
|
啟動腳本 |
電腦設定 →腳本 |
Detect-SecureBootCertUpdateStatus.ps1 |
|
腳本參數 |
(一樣) |
-輸出路徑「\\server\share$」 |
|
執行政策 |
Computer Config → 管理員 Templates → PowerShell |
允許本地與遠端簽署 |
|
排定的工作 |
電腦設定 →偏好設定→排程任務 |
每日/每週收款 |
驗證
-
Force GPO 更新於 Test Machine
## On a test workstation GP更新/力 # 重新啟動客戶端機器到啟動腳本,否則會在下一個排程觸發。Restart-Computer -原力
-
驗證資料收集
# 檢查資料是否 (檔案伺服器或任何機器收集) Get-ChildItem “\\fileserver\SecureBootData$” | Sort-Object 最後寫作時間 -下降 | Select-Object -前十 名 # 驗證 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\」
第二階段:安全開機憑證更新編排腳本
重要: 確保第一階段完成,包括在每個端點收集資料至遠端伺服器共享。
在本節中
第二階段所需腳本
安全啟動庫存資料收集腳本範例
|
範例劇本名稱 |
目的 |
執行 |
|
收集裝置狀態資料 |
每個端點都透過 GPO) ( |
|
|
產生報告與儀表板 |
管理員工作站 |
|
|
自動化建立 GPO 以進行資料收集 |
網域控制器 |
|
|
全自動化、持續協調,並自動部署 GPO 以安裝憑證 |
管理員工作站 |
|
|
部署 Orchestrator 腳本作為排程任務以進行自動部署 |
網域控制器 |
|
|
從任何工作站查看安全開機憑證的推出狀態 |
管理員工作站 |
|
|
啟用安全開機更新任務 |
在任務被停用的端點 (如果已停用,則只能執行一次以啟用該任務) |
Start-SecureBootRolloutOrchestrator.ps1
-
目的: 全自動化、持續編排,並自動部署 GPO。
-
它有什麼作用
-
通話 Aggregate-SecureBootData.ps1 裝置狀態
-
利用漸進倍增產生滾動波
-
建立用於憑證部署的 GPO,使用以下方法之一
-
安全開機群組政策 AvailableUpdatesPolicy = 0x5944 (預設)
-
WinCS 方法 (參數 –使用WinCS)
-
-
建立 AD 安全群組以進行目標鎖定
-
將電腦帳號加入安全群組
-
配置 GPO 安全過濾
-
連結 GPO 與目標 OU
-
監控被阻塞的桶 (無法接觸的裝置)
-
裝置恢復時自動解除封鎖
-
-
使用方式
# Interactive (testing) .\Start-SecureBootRolloutOrchestrator.ps1 -AggregationInputPath “\\fileserver\SecureBootData$” ' - ReportBasePath 「C:\SecureBootReports」 -投票間隔 30 分鐘
# Interactive (testing), leveraging WinCS method .\Start-SecureBootRolloutOrchestrator.ps1 -AggregationInputPath “\\fileserver\SecureBootData$” ' - ReportBasePath 「C:\SecureBootReports」 -PollInterval Minutes 1440 -UseWinCS
-
管理員指令
# List blocked buckets .\Start-SecureBootRolloutOrchestrator.ps1 -ReportBasePath “C:\SecureBootReports” -ListBlockedBuckets
# Unblock specific bucket .\Start-SecureBootRolloutOrchestrator.ps1 -ReportBasePath “C:\SecureBootReports” -UnblockBucket “Dell|緯度5520|BIOS1.2”
# Unblock all .\Start-SecureBootRolloutOrchestrator.ps1 -ReportBasePath “C:\SecureBootReports” -UnblockAll
-
參數
參數
預設值
描述
聚合輸入路徑
必要
UNC 路徑至端點 JSON 檔案
報告基礎路徑
必要
報告與狀態的本地路徑
TargetOU
網域根
OU 以連結 GPO
WavePrefix
SecureBoot-Rollout
GPO/群組命名前綴
MaxWaitHours
72
檢查裝置可達性前幾小時
輪詢間隔分鐘
1440
狀態檢查之間的分鐘
試演
False
展示如果沒有改變會發生什麼
Deploy-OrchestratorTask.ps1
-
目的: 將編排器部署為 Windows 排程任務。
-
權益
-
執行策略繞過 (沒有 PowerShell 安全提示)
-
持續在背景中運行
-
不需要使用者互動
-
重啟版存活
-
-
使用方式
-
建議 (用網域服務帳號部署)
-
使用 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
-
服務帳戶要求
-
新 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 ---------------------------------------- 狀態:進行中 當前浪:5 目標總數:1250 總更新:847
Progress: [█████████████████████░░░░░░░░░░░░░░░░░░░] 67.8%
BLOCKED BUCKETS: 2 buckets need attention 詳情請使用 -ShowBlocked 查詢
LATEST DASHBOARD C:\SecureBootReports\Aggregation_20260217_193000\SecureBoot_Dashboard.html __________________________________________________________________________________________
端對端部署步驟 (快速參考指南)
在本節中
第一階段:偵測基礎設施
-
步驟 1:建立收藏 分享
# On file server $sharePath = “D:\SecureBootData” New-Item -ItemType Directory -Path $sharePath -Force New-SmbShare -name “SecureBootData$” -Path $sharePath - FullAccess “Domain Admins” -ChangeAccess “Domain Computers”
# Set NTFS permissions $acl = Get-Acl $sharePath $rule = New-Object System.Security.AccessControl.FileSystemAccessRule (「Domain Computers」、「Modify」、「Allow」) $acl。AddAccessRule ($rule) Set-Acl $sharePath $acl
-
步驟 2:部署偵測 GPO
.\Deploy-GPO-SecureBootCollection.ps1 ` - 網域名稱「contoso.com」 -OUPath 「OU=工作站,DC=contoso,DC=com」 -CollectionSharePath 「\\server\SecureBootData$」
-
步驟 3:等待端點回報 24-48 小時 ()
# 檢查收款進度 (Get-ChildItem “\\server\SecureBootData$” -Filter “*.json”) 。伯爵
第二階段:協調推出
-
步驟四:先修條件檢查
-
偵測 GPO 部署 (第二步)
-
至少有 50+ 個端點報告 JSON
-
具有網域管理員權限的服務帳號
-
使用 PowerShell 5.1+ 的管理伺服器
-
-
步驟 5:部署 Orchestrator 作為排程任務
.\Deploy-OrchestratorTask.ps1 ` -AggregationInputPath “\\server\SecureBootData$” ' - ReportBasePath 「C:\SecureBootReports」 -ServiceAccount 「DOMAIN\svc_secureboot」
-
步驟六:監控進度
.\Get-SecureBootRolloutStatus.ps1 -ReportBasePath "C:\SecureBootReports"
-
步驟7:檢視儀表板
.\Get-SecureBootRolloutStatus.ps1 -ReportBasePath "C:\SecureBootReports" -OpenDashboard
-
步驟八:管理阻塞桶
# 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" # 狀態應該顯示「完成」
State 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