Статус BitLocker
Показывает защиту томов BitLocker и типы ключей без recovery-паролей.
Что делает скрипт
Скрипт читает Get-BitLockerVolume и выводит точку монтирования, состояние тома и защиты, процент шифрования, метод и типы key protector. Recovery-пароли и ключи не запрашиваются и не выводятся. Тома без включённой защиты отмечаются предупреждением.
Быстрый старт
powershell -File BitLockerStatus.ps1
Скачайте файл, откройте терминал в папке со скриптом и выполните команду. Запускайте в PowerShell 5.1 или PowerShell 7.
Другие варианты
powershell -File BitLockerStatus.ps1 -AsJsonpowershell -File BitLockerStatus.ps1 | Out-File bitlocker.txt
Что понадобится
Встроен в Windows 10/11 (PowerShell 5.1)
BitLockerStatus.ps1
[CmdletBinding()]
param(
[switch]$AsJson
)
$ErrorActionPreference = 'Stop'
if (-not (Get-Command Get-BitLockerVolume -ErrorAction SilentlyContinue)) {
Write-Error 'Командлет Get-BitLockerVolume недоступен. Нужны Windows Pro или Enterprise.'
exit 2
}
try {
$volumes = @(Get-BitLockerVolume -ErrorAction Stop)
} catch {
Write-Error "Не удалось получить статус BitLocker: $($_.Exception.Message)"
exit 2
}
$result = @()
foreach ($volume in $volumes) {
$protectors = @($volume.KeyProtector | ForEach-Object { [string]$_.KeyProtectorType })
$result += [pscustomobject]@{
MountPoint = $volume.MountPoint
VolumeStatus = [string]$volume.VolumeStatus
ProtectionStatus = [string]$volume.ProtectionStatus
EncryptionPercentage = $volume.EncryptionPercentage
EncryptionMethod = [string]$volume.EncryptionMethod
KeyProtectors = $protectors
}
}
if ($AsJson) {
$result | ConvertTo-Json -Depth 5
exit 0
}
$result | Format-Table MountPoint, VolumeStatus, ProtectionStatus, EncryptionPercentage, EncryptionMethod -AutoSize
$unprotected = @($result | Where-Object { $_.ProtectionStatus -ne 'On' })
if ($unprotected.Count -gt 0) {
Write-Warning ("Без включённой защиты: " + (($unprotected | ForEach-Object { $_.MountPoint }) -join ', '))
exit 1
}
Write-Host 'Все тома под защитой BitLocker.'
exit 0
Скрипты работают с файлами и настройками системы. Перед запуском прочитайте код и проверьте пути. Особенно если скрипт удаляет, перезаписывает или перемещает данные.