Script repository

Output BitLocker recovery password

Updated on: Jan 18, 2026, Views: 9435

Miscellaneous

The script outputs a BitLocker recovery password of a computer into the execution log. To execute the script, create a business rule, custom command or scheduled task configured for the Computer object type.

# Search parameters
$searcher = $Context.TargetObject
$searcher.Criteria = New-AdmCriteria "msFVE-RecoveryInformation"
$searcher.SearchScope = "ADS_SCOPE_SUBTREE"
$searcher.ReferralChasing = "ADS_CHASE_REFERRALS_NEVER"
$searcher.SetPropertiesToLoad(@("msFVE-RecoveryPassword", "name"))

try
{
    # Execure search
    $searchResultIterator = $searcher.ExecuteSearch()
    $searchResults = $searchResultIterator.FetchAll()
    
    if ($searchResults.Count -eq 0)
    {
        # No BitLocker recovery information found under the current computer object.
        $Context.LogMessage("This computer doesn't store its BitLocker recovery information in AD", "Information")
        return
    }
    
    foreach ($searchResult in $searchResults)
    {
        $name = $searchResult.Properties["name"].Value
        $recoveryPassword = $searchResult.Properties["msFVE-RecoveryPassword"].Value
        
        $Context.LogMessage("Recovery information entry: " + $name, "Information")
        $Context.LogMessage("Recovery password: " + $recoveryPassword, "Information")
    }
}
finally
{
    # Release resources
    $searchResultIterator.Dispose()
}

Comments 7

You must be signed in to comment.

  • Alexander Bøegh

    Alexander Bøegh

    Hi Adaxes
    Thanks for this script. Could we get one that pulls the information from Azure instead of the local AD?

    • Support

      Support

      Hello Alexander,

      Unfortunately, we do not have such a script.

  • Andrew Millican

    Andrew Millican

    When using this custom command in the web console, the recovery information cannot be copied from the results window. Is there something I need to change or allow for it to be able to be copied?

    • Support

      Support

      Hello Andrew,

      There are no such restrictions in Adaxes. If you face issues copying data from the execution log, the only possible cause is your web browser settings.

      • Andrew Millican

        Andrew Millican

        Yeah, we figured it out, when you select it it's highlighted, so we thought you could copy it. Ended up we just needed to select the text. So yes, it was user error.

  • Ilia Goldenberg

    Ilia Goldenberg

    Hi,

    Is there an option / suggestion on how to show the output without adding it to the execution log?

    Thanks,
    Ilia

    • Support

      Support

      Hello Ilia,

      Unfortunately, there are no other options. Using the execution log is the only option to make an output in Adaxes scripts.

Got questions?

Support Questions & Answers

We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.