Share via

Script advice based on Get bitlockerRecoveryKey

Steve Wakefield 1 Reputation point Microsoft External Staff
2022-05-13T22:54:09.903+00:00

I have a customer who wants to access the bitlocker key using only a script, no portal.

Based on 'Get bitlockerRecoveryKey', this has gotten him part of the way, but wondering if anyone has written an example script or could guide us further?

Get bitlockerRecoveryKey - https://learn.microsoft.com/en-us/graph/api/bitlockerrecoverykey-get?view=graph-rest-1.0&tabs=powershell

Kindest Regards,
Steve

Azure Key Vault
Azure Key Vault

An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.

Windows for business | Windows Server | User experience | PowerShell

2 answers

Sort by: Most helpful
  1. Limitless Technology 40,106 Reputation points
    2022-05-18T14:35:32.55+00:00

    Hello SteveWakefield

    Yes, you can use the next script to retrieve the recovery key programatedly:

    $BitlockerVolumers = Get-BitLockerVolume
    $BitlockerVolumers |
    ForEach-Object {
    $MountPoint = $_.MountPoint
    $RecoveryKey = string.RecoveryPassword
    if ($RecoveryKey.Length -gt 5) {
    Write-Output ("The drive $MountPoint has a recovery key $RecoveryKey.")
    }
    }

    Hope this helps with your query,


    --If the reply is helpful, please Upvote and Accept as answer--

    Was this answer helpful?


  2. T. Kujala 8,806 Reputation points
    2022-05-14T04:20:37.807+00:00

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.