powershellbitlocker

How do I get a specific value from a line in powershell


I'm trying to get a specific value out of the manage-bde -status C: command, which returns the following: BitLocker Drive Encryption: Configuration Tool version 10.0.18362 Copyright (C) 2013 Microsoft Corporation. All rights reserved.

Volume C: [] [OS Volume]

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

I'm trying to get the end of the line labelled Protection Status and return Off


Solution

  • As per my comment, I would use Get-BitLockerVolume instead as it returns an object which is easier to query:

    Get-BitLockerVolume -MountPoint C: | Select-Object -ExpandProperty ProtectionStatus