Áp dụng cho
Windows 10 Windows 10, version 1607, all editions Windows 10 Enterprise LTSC 2019 Win 10 IoT Ent LTSC 2019 Windows 10 IoT Core LTSC Windows 10 Enterprise LTSC 2021 Windows 10 IoT Enterprise LTSC 2021 Windows 10, version 22H2, all editions Windows 11 Home and Pro, version 21H2 Windows 11 Enterprise Multi-Session, version 21H2 Windows 11 Enterprise and Education, version 21H2 Windows 11 IoT Enterprise, version 21H2 Windows 11 Home and Pro, version 22H2 Windows 11 Enterprise Multi-Session, version 22H2 Windows 11 Enterprise and Education, version 22H2 Windows 11 IoT Enterprise, version 22H2 Windows 11 SE, version 23H2 Windows 11 Home and Pro, version 23H2 Windows 11 Enterprise and Education, version 23H2 Windows 11 Enterprise Multi-Session, version 23H2 Windows 11 SE, version 24H2 Windows 11 Enterprise and Education, version 24H2 Windows 11 Enterprise Multi-Session, version 24H2 Windows 11 Home and Pro, version 24H2 Windows 11 IoT Enterprise, version 24H2 Windows Server 2012 ESU Windows Server 2012 R2 ESU Windows Server 2016 Windows Server 2019 Windows Server 2022 Windows Server 2025

Ngày phát hành ban đầu: Ngày 17 tháng 11 năm 2025

ID KB: 5072718

Tập lệnh Thu thập Dữ liệu Kiểm kê Khởi động An toàn Mẫu

Sao chép và dán tập lệnh mẫu này và sửa đổi khi cần thiết cho môi trường của bạn: Tập lệnh Thu thập dữ liệu kiểm kê khởi động an toàn mẫu.

Sample_Secure_Boot_Inventory_Data_Collection_script

# 1. HostName # PS Phiên bản: Tất cả | Quản trị: Không | Yêu cầu Hệ thống: Không có hãy thử {     $hostname = $env:COMPUTERNAME     if ([string]::IsNullOrEmpty($hostname)) {         Write-Warning "Không thể xác định tên máy chủ"         $hostname = "Không xác định"     }     Write-Host "Hostname: $hostname" } bắt {     Write-Warning "Lỗi khi truy xuất tên máy chủ: $_"     $hostname = "Lỗi"     Write-Host "Hostname: $hostname" }

# 2. CollectionTime # PS Phiên bản: Tất cả | Quản trị: Không | Yêu cầu Hệ thống: Không có hãy thử {     $collectionTime = Get-Date     if ($null -eq $collectionTime) {         Write-Warning "Không thể truy xuất ngày/giờ hiện tại"         $collectionTime = "Không xác định"     }     Write-Host "Thời gian Thu thập: $collectionTime" } bắt {     Write-Warning "Lỗi khi truy xuất ngày/giờ: $_"     $collectionTime = "Lỗi"     Write-Host "Thời gian thu thập: $collectionTime" }

# Registry: Secure Boot Main Key (3 values)

# 3. SecureBootEnabled # PS Phiên bản: 3.0+ | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Hệ thống có khả năng khởi động UEFI/Secure hãy thử {     $secureBootEnabled = Confirm-SecureBootUEFI -ErrorAction Stop     Write-Host "Đã bật Khởi động An toàn: $secureBootEnabled" } bắt {     Write-Warning "Không thể xác định trạng thái Khởi động An toàn qua lệnh ghép ngắn: $_"     # Thử bản dự phòng đăng ký     hãy thử {         $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\State" -Name UEFISecureBootEnabled -ErrorAction Stop         $secureBootEnabled = [bool]$regValue.UEFISecureBootEnabled         Write-Host "Đã bật Khởi động An toàn: $secureBootEnabled"     } bắt {         Write-Warning "Không thể xác định trạng thái Khởi động An toàn thông qua sổ đăng ký. Hệ thống có thể không hỗ trợ Khởi động UEFI/An toàn."         $secureBootEnabled = $null         Write-Host "Đã bật Khởi động An toàn: Không Khả dụng"     } }

# 4. HighConfidenceOptOut # PS Phiên bản: Tất cả | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Không có hãy thử {     $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot" -Name HighConfidenceOptOut -ErrorAction Stop     $highConfidenceOptOut = $regValue.HighConfidenceOptOut     Write-Host "Lựa chọn không tham gia tin cậy cao: $highConfidenceOptOut" } bắt {     Write-Warning "Không tìm thấy hoặc không thể truy nhập khóa đăng ký HighConfidenceOptOut"     $highConfidenceOptOut = $null     Write-Host "Chọn không tham gia có độ tin cậy cao: Không Sẵn dùng" }

# 5. AvailableUpdates # PS Phiên bản: Tất cả | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Không có hãy thử {     $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot" -Name AvailableUpdates -ErrorAction Stop     $availableUpdates = $regValue.AvailableUpdates     if ($null -ne $availableUpdates) {         # Chuyển đổi thành định dạng thập lục phân         $availableUpdatesHex = "0x{0:X}" -f $availableUpdates         Write-Host "Có sẵn Cập nhật: $availableUpdatesHex"     } người khác {         Write-Host "Sẵn có Cập nhật: Không Sẵn dùng"     } } bắt {     Write-Warning "Không tìm thấy hoặc không thể truy nhập khóa đăng ký AvailableUpdates"     $availableUpdates = $null     Write-Host "Sẵn có Cập nhật: Không Sẵn dùng" }

# Registry: Servicing Key (3 values)

# 6. UEFICA2023Status # PS Phiên bản: Tất cả | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Không có hãy thử {     $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing" -Name UEFICA2023Status -ErrorAction Stop     $uefica 2023Status = $regValue.UEFICA2023Status     Write-Host "Trạng thái UEFI CA 2023: $uefica 2023Status" } bắt {     Write-Warning "Không tìm thấy hoặc không thể truy nhập khóa đăng ký UEFICA2023Status"     $uefica 2023Status = $null     Write-Host "Trạng thái UEFI CA 2023: Không Sẵn dùng" }

# 7. UEFICA2023Capable # PS Phiên bản: Tất cả | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Không có hãy thử {     $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing" -Name UEFICA2023Capable -ErrorAction Stop     $uefica 2023Capable = $regValue.UEFICA2023Capable     Write-Host "UEFI CA 2023 Có khả năng: $uefica 2023Capable" } bắt {     Write-Warning "Không tìm thấy hoặc không thể truy nhập khóa đăng ký UEFICA2023Capable"     $uefica 2023Capable = $null     Write-Host "UEFI CA 2023 Có khả năng: Không khả dụng" }

# 8. UEFICA2023Error # PS Phiên bản: Tất cả | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Không có hãy thử {     $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\Servicing" -Name UEFICA2023Error -ErrorAction Stop     $uefica 2023Error = $regValue.UEFICA2023Error     Write-Host "Lỗi UEFI CA 2023: $uefica 2023Error" } bắt {     Write-Warning "Không tìm thấy hoặc không thể truy nhập khóa đăng ký UEFICA2023Error"     $uefica 2023Error = $null     Write-Host "Lỗi UEFI CA 2023: Không Khả dụng" }

# Registry: Device Attributes (7 values)

# 9. OEMManufacturerName # PS Phiên bản: Tất cả | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Không có hãy thử {     $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\DeviceAttributes" -Name OEMManufacturerName -ErrorAction Stop     $oemManufacturerName = $regValue.OEMManufacturerName     if ([string]::IsNullOrEmpty($oemManufacturerName)) {         Write-Warning "OEMManufacturerName trống"         $oemManufacturerName = "Không xác định"     }     Write-Host "Tên Nhà sản xuất OEM: $oemManufacturerName" } bắt {     Write-Warning "Không tìm thấy hoặc không thể truy nhập khóa đăng ký OEMManufacturerName"     $oemManufacturerName = $null     Write-Host "Tên Nhà sản xuất OEM: Không Khả dụng" }

# 10. OEMModelSystemFamily # PS Phiên bản: Tất cả | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Không có hãy thử {     $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\DeviceAttributes" -Name OEMModelSystemFamily -ErrorAction Stop     $oemModelSystemFamily = $regValue.OEMModelSystemFamily     if ([string]::IsNullOrEmpty($oemModelSystemFamily)) {         Write-Warning "OEMModelSystemFamily là trống"         $oemModelSystemFamily = "Không xác định"     }     Write-Host "Dòng Hệ thống Mô hình OEM: $oemModelSystemFamily" } bắt {     Write-Warning "Không tìm thấy hoặc không thể truy nhập khóa đăng ký OEMModelSystemFamily"     $oemModelSystemFamily = $null     Write-Host "Dòng Hệ thống Mô hình OEM: Không Khả dụng" }

# 11. OEMModelNumber # PS Phiên bản: Tất cả | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Không có hãy thử {     $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\DeviceAttributes" -Name OEMModelNumber -ErrorAction Stop     $oemModelNumber = $regValue.OEMModelNumber     if ([string]::IsNullOrEmpty($oemModelNumber)) {         Write-Warning "OEMModelNumber là trống"         $oemModelNumber = "Không xác định"     }     Write-Host "Số Kiểu OEM: $oemModelNumber" } bắt {     Write-Warning "Không tìm thấy hoặc không thể truy nhập khóa đăng ký OEMModelNumber"     $oemModelNumber = $null     Write-Host "Số Kiểu OEM: Không Khả dụng" }

# 12. FirmwareVersion # PS Phiên bản: Tất cả | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Không có hãy thử {     $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\DeviceAttributes" -Name FirmwareVersion -ErrorAction Stop     $firmwareVersion = $regValue.FirmwareVersion     if ([string]::IsNullOrEmpty($firmwareVersion)) {         Write-Warning "FirmwareVersion bị trống"         $firmwareVersion = "Không xác định"     }     Write-Host "Phiên bản Vi chương trình: $firmwareVersion" } bắt {     Write-Warning "Không tìm thấy hoặc không thể truy nhập khóa đăng ký FirmwareVersion"     $firmwareVersion = $null     Write-Host "Phiên bản Vi chương trình: Không Khả dụng" }

# 13. FirmwareReleaseDate # PS Phiên bản: Tất cả | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Không có hãy thử {     $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\DeviceAttributes" -Name FirmwareReleaseDate -ErrorAction Stop     $firmwareReleaseDate = $regValue.FirmwareReleaseDate     if ([string]::IsNullOrEmpty($firmwareReleaseDate)) {         Write-Warning "FirmwareReleaseDate bị trống"         $firmwareReleaseDate = "Không xác định"     }     Write-Host "Ngày Phát hành Vi chương trình: $firmwareReleaseDate" } bắt {     Write-Warning "Không tìm thấy hoặc không thể truy nhập khóa đăng ký FirmwareReleaseDate"     $firmwareReleaseDate = $null     Write-Host "Ngày Phát hành Vi chương trình: Không Khả dụng" }

# 14. OSArchitecture # PS Phiên bản: Tất cả | Quản trị: Không | Yêu cầu Hệ thống: Không có hãy thử {     $osArchitecture = $env:PROCESSOR_ARCHITECTURE     if ([string]::IsNullOrEmpty($osArchitecture)) {         # Thử bản dự phòng đăng ký         $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\DeviceAttributes" -Name OSArchitecture -ErrorAction Stop         $osArchitecture = $regValue.OSArchitecture     }     if ([string]::IsNullOrEmpty($osArchitecture)) {         Write-Warning "OSArchitecture không thể xác định được"         $osArchitecture = "Không xác định"     }     Write-Host "Kiến trúc HĐH: $osArchitecture" } bắt {     Write-Warning "Lỗi truy xuất OSArchitecture: $_"     $osArchitecture = "Không xác định"     Write-Host "Kiến trúc HĐH: $osArchitecture" }

# 15. CanAttemptUpdateAfter (FILETIME) # PS Phiên bản: Tất cả | Quản trị: Có thể được yêu cầu | Yêu cầu Hệ thống: Không có hãy thử {     $regValue = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\DeviceAttributes" -Name CanAttemptUpdateAfter -ErrorAction Stop     $canAttemptUpdateAfter = $regValue.CanAttemptUpdateAfter     # Chuyển đổi FILETIME thành DateTime nếu đó là số hợp lệ     if ($null -ne $canAttemptUpdateAfter -and $canAttemptUpdateAfter -is [long]) {         hãy thử {             $canAttemptUpdateAfter = [DateTime]::FromFileTime($canAttemptUpdateAfter)         } bắt {             Write-Warning "Không thể chuyển đổi CanAttemptUpdateAfter FILETIME thành DateTime"         }     }     Write-Host "Có thể Thử Cập nhật Sau: $canAttemptUpdateAfter" } bắt {     Write-Warning "CanAttemptUpdateAfter registry key not found or inaccessible"     $canAttemptUpdateAfter = $null     Write-Host "Có thể Thử Cập nhật Sau: Không Khả dụng" }

# Event Logs: System Log (5 values)

# 16-20. Event Log queries # PS Phiên bản: 3.0+ | Quản trị: Có thể được yêu cầu đối với Nhật ký hệ thống | Yêu cầu Hệ thống: Không có hãy thử {     $allEventIds = @(1801, 1808)     $events = @(Get-WinEvent -FilterHashtable @{LogName='System'; ID=$allEventIds} -MaxEvents 20 -ErrorAction Stop)

    if ($events.Count -eq 0) {         Write-Warning "Không có sự kiện Khởi động An toàn (1801/1808) được tìm thấy trong Nhật ký hệ thống"         $latestEventId = $null         $bucketId = $null         $confidence = $null         $event 1801Count = 0         $event 1808Count = 0         Write-Host "ID Sự kiện Mới nhất: Không Sẵn dùng"         Write-Host "Bucket ID: Not Available"         Write-Host "Tự tin: Không Sẵn dùng"         Write-Host "Số sự kiện 1801: 0"         Write-Host "Số sự kiện 1808: 0"     } người khác {         # 16. LatestEventId         $latestEvent = $events | Sort-Object tạo thời gian -Giảm dần | Select-Object -1 đầu tiên         if ($null -eq $latestEvent) {             Write-Warning "Không thể xác định sự kiện mới nhất"             $latestEventId = $null             Write-Host "ID Sự kiện Mới nhất: Không Sẵn dùng"         } người khác {             $latestEventId = $latestEvent.Id             Write-Host "ID Sự kiện Mới nhất: $latestEventId"         }

        # 17. BucketID - Extracted from Event 1801/1808 if ($null -ne $latestEvent -and $null -ne $latestEvent.Message) {             if ($latestEvent.Message -match 'BucketId:\s*(.+)') {                 $bucketId = $matches[1]. Trim()                 Write-Host "Bucket ID: $bucketId"             } người khác {                 Write-Warning "BucketId không tìm thấy trong thông báo sự kiện"                 $bucketId = $null                 Write-Host "Bucket ID: Not Found in Event"             }         } người khác {             Write-Warning "Sự kiện hoặc thư mới nhất là null, không thể trích xuất BucketId"             $bucketId = $null             Write-Host "Bucket ID: Not Available"         }

        # 18. Confidence - Extracted from Event 1801/1808 if ($null -ne $latestEvent -and $null -ne $latestEvent.Message) {             if ($latestEvent.Message -match 'BucketConfidenceLevel:\s*(.+)') {                 $confidence = $matches[1]. Trim()                 Write-Host "Confidence: $confidence"             } người khác {                 Write-Warning "Không tìm thấy mức tin cậy trong thông báo sự kiện"                 $confidence = $null                 Write-Host "Confidence: Not Found in Event"             }         } người khác {             Write-Warning "Sự kiện hoặc thư mới nhất là null, không thể trích xuất Tin cậy"             $confidence = $null             Write-Host "Tin cậy: Không Sẵn dùng"         }

        # 19. Event1801Count $event 1801Array = @($events | Where-Object {$_. Id -eq 1801})         $event 1801Count = $event 1801Array.Count         Write-Host "Số lượng Sự kiện 1801: $event 1801Count"

        # 20. Event1808Count $event 1808Array = @($events | Where-Object {$_. Id -eq 1808})         $event 1808Count = $event 1808Array.Count         Write-Host "Số lượng Sự kiện 1808: $event 1808Count"     } } bắt {     Write-Warning "Lỗi khi truy xuất nhật ký sự kiện. Có thể yêu cầu đặc quyền của người quản trị: $_"     $latestEventId = $null     $bucketId = $null     $confidence = $null     $event 1801Count = 0     $event 1808Count = 0     Write-Host "ID Sự kiện Mới nhất: Lỗi"     Write-Host "Bucket ID: Error"     Write-Host "Confidence: Error"     Write-Host "Số sự kiện 1801: 0"     Write-Host "Số sự kiện 1808: 0" }

# WMI/CIM Queries (4 values)

# 21. OSVersion # PS Phiên bản: 3.0+ (sử Get-WmiObject cho 2.0) | Quản trị: Không | Yêu cầu Hệ thống: Không có hãy thử {     $osInfo = Get-CimInstance Win32_OperatingSystem -ErrorAction Stop     if ($null -eq $osInfo -or [string]::IsNullOrEmpty($osInfo.Version)) {         Write-Warning "Không thể truy xuất phiên bản HĐH"         $osVersion = "Không xác định"     } người khác {         $osVersion = $osInfo.Phiên bản     }     Write-Host "Phiên bản HĐH: $osVersion" } bắt {     Write-Warning "Lỗi khi truy xuất phiên bản HĐH: $_"     $osVersion = "Không xác định"     Write-Host "Phiên bản HĐH: $osVersion" }

# 22. LastBootTime # PS Phiên bản: 3.0+ (sử Get-WmiObject cho 2.0) | Quản trị: Không | Yêu cầu Hệ thống: Không có hãy thử {     $osInfo = Get-CimInstance Win32_OperatingSystem -ErrorAction Stop     if ($null -eq $osInfo -or $null -eq $osInfo.LastBootUpTime) {         Write-Warning "Không thể truy xuất lần khởi động gần nhất"         $lastBootTime = $null         Write-Host "Thời gian Khởi động Lần cuối: Không Khả dụng"     } người khác {         $lastBootTime = $osInfo.LastBootUpTime         Write-Host "Thời gian Khởi động Lần cuối: $lastBootTime"     } } bắt {     Write-Warning "Lỗi truy xuất thời gian khởi động gần nhất: $_"     $lastBootTime = $null     Write-Host "Thời gian Khởi động Lần cuối: Không Khả dụng" }

# 23. BaseBoardManufacturer # PS Phiên bản: 3.0+ (sử Get-WmiObject cho 2.0) | Quản trị: Không | Yêu cầu Hệ thống: Không có hãy thử {     $baseBoard = Get-CimInstance Win32_BaseBoard -ErrorAction Stop     if ($null -eq $baseBoard -or [string]::IsNullOrEmpty($baseBoard.Manufacturer)) {         Write-Warning "Không thể truy xuất nhà sản xuất baseboard"         $baseBoardManufacturer = "Không xác định"     } người khác {         $baseBoardManufacturer = $baseBoard.Nhà sản xuất     }     Write-Host "Nhà sản xuất Bảng cơ sở: $baseBoardManufacturer" } bắt {     Write-Warning "Lỗi khi truy xuất nhà sản xuất bảng cơ sở: $_"     $baseBoardManufacturer = "Không xác định"     Write-Host "Nhà sản xuất Bảng cơ sở: $baseBoardManufacturer" }

# 24. BaseBoardProduct # PS Phiên bản: 3.0+ (sử Get-WmiObject cho 2.0) | Quản trị: Không | Yêu cầu Hệ thống: Không có hãy thử {     $baseBoard = Get-CimInstance Win32_BaseBoard -ErrorAction Stop     if ($null -eq $baseBoard -or [string]::IsNullOrEmpty($baseBoard.Product)) {         Write-Warning "Không thể truy xuất sản phẩm baseboard"         $baseBoardProduct = "Không xác định"     } người khác {         $baseBoardProduct = $baseBoard.Product     }     Write-Host "Sản phẩm Bảng cơ sở: $baseBoardProduct" } bắt {     Write-Warning "Lỗi khi truy xuất sản phẩm baseboard: $_"     $baseBoardProduct = "Không xác định"     Write-Host "Sản phẩm Baseboard: $baseBoardProduct"}

Bạn cần thêm trợ giúp?

Bạn muốn xem các tùy chọn khác?

Khám phá các lợi ích của gói đăng ký, xem qua các khóa đào tạo, tìm hiểu cách bảo mật thiết bị của bạn và hơn thế nữa.