Bitlocker Code

# November 28, 2017 - TJY
# Generate a list of Bitlocker recovery keys and display them at the command prompt.
#

# Identify all the Bitlocker volumes.
$BitlockerVolumers = Get-BitLockerVolume

# For each volume, get the RecoveryPassowrd and display it.
$BitlockerVolumers |
    ForEach-Object {
        $MountPoint = $_.MountPoint 
        $RecoveryKey = [string]($_.KeyProtector).RecoveryPassword       
        if ($RecoveryKey.Length -gt 5) {
        
    Write-Output ServerUtilsSetMachineProperty(@ThisMachine(),BitLocker,$RecoveryKey)
    
            }        
    }

Did you find this article useful?