Public/Get-BitLockerStatus.ps1

Function Get-BitLockerStatus {
    $Result = manage-bde -Status

    if ($Result -eq "BitLocker Drive Encryption: Configuration Tool version 10.0.19041
Copyright (C) 2013 Microsoft Corporation. All rights reserved.
 
ERROR: An attempt to access a required resource was denied.
 
Check that you have administrative rights on the computer."
) {
        Write-Error "Rerun command as admin"
    }

    $KeyProtectors = ""
    Foreach ($i in 17..18) {
        $KeyProtectors += $Result[$i].Trim().ToString() + ", "
    }

    $Status = [PSCustomObject]@{
        Volume                 = ($Result[5] -split " ")[-2].Trim()
        "Volume Name"          = ($Result[5] -split " ")[-1].Trim()
        Size                   = ($Result[8] -split " ")[-1].Trim()
        "Conversion Status"    = ($Result[10] -split " ")[-1].Trim()
        "Percentage Encrypted" = ($Result[11] -split " ")[-1].Trim()
        "Protection Status"    = ($Result[13] -split " ")[-1].Trim()
        "Lock Status"          = ($Result[14] -split " ")[-1].Trim()
        "Key Protectors"       = $KeyProtectors.Trim(", ")
    }
    Return $Status
}