2

我正在尝试从命令中获取特定值,该manage-bde -status C:命令返回以下内容:BitLocker 驱动器加密:配置工具版本 10.0.18362 版权所有 (C) 2013 Microsoft Corporation。版权所有。

卷 C:[] [操作系统卷]

Size:                 237.29 GB
BitLocker Version:    None
Conversion Status:    Fully Decrypted
Percentage Encrypted: 0.0%
Encryption Method:    None
Protection Status:    Protection Off
Lock Status:          Unlocked
Identification Field: None
Key Protectors:       None Found

我正在尝试获取标记为保护状态的行的末尾并返回关闭

4

3 回答 3

2

根据我的评论,我会改用Get-BitLockerVolume它,因为它返回一个更容易查询的对象:

Get-BitLockerVolume -MountPoint C: | Select-Object -ExpandProperty ProtectionStatus
于 2020-02-04T09:17:08.533 回答
0

我使用类似于上面帖子的内容来确定是否已通过制造商的驱动器启用了 BitLocker,该驱动器在标识字段中始终具有未知或没有。

# Check for OEM configuration of BitLocker

$blidfield = manage-bde -status C: | Select-String 'Identification Field'
$bloemencrypted = manage-bde -status C: | Select-String 'Conversion Status'
if ($blidfield -match 'None' -or $blidfield -match 'Unknown' -and ($bloemencrypted -match 'Fully Encrypted' -or $bloemencrypted -match 'Used Space Only Encrypted')){
    Write-Log "BitLocker appears to be configured with OEM configuration, Starting to decrypt."
    manage-bde -off C:
    exit
} else {
    Write-Log "BitLocker doesn't appear to be configured with OEM configuration"
}

请注意,“manage-bde -off C:”行将解密操作系统驱动器。

于 2020-11-30T03:39:12.417 回答
0

如果我理解正确,您想检查它是否在保护状态下匹配关闭?如果是这样,这是我快速完成的一段丑陋的代码,但可以得到你想要的:

$status = manage-bde -status C: | Select-String 'Protection'
if ($status -match 'Off'){
Write-Output $true
} else {
Write-Host $false
}
于 2020-02-04T09:14:54.663 回答