BitLocker Detection and Recovery Key Retrieval 2.0

Sidney Sahdala
Sidney Sahdala Member, Kaseya Certified, Kaseyan, Kaseya Staff

KASEYAN

edited May 2022 in Solutions

Product Name: BitLocker Detection and Recovery Key Retrieval

Version: 2.0

Description : This agent procedure checks the C drive to see if it is encrypted using BitLocker and extract the BitLocker Recovery key then document the results to the asset, in the Audit module. This uses Custom Fields in VSA allowing you to create Views, Report on it, or even use the View in a Policy.

If you want to check other drives, you just need to edit the PowerShell command in the Agent Procedure to check a different disk.

This agent procedure is the latest version that performs some error checking before entering the result in the custom field. It checks for the presence of the BitLocker feature as the previous version wasn’t accurate in these cases.

Instructions :

This requires you to create two custom fields named BitLocker Status and BitLocker Recovery Key of type String. Once the Custom Fields are created, you can import the Agent Procedure.

You can create Custom Fields in the Audit module by going to:

VSA > Audit > View Individual Data > Machine Summary

Then import the Agent Procedure by going to:

VSA > Agent Procedures > Schedule / Create

After it has been properly imported the you just need to run this against your Windows endpoints. You can either run them manually or add it to a Policy under a schedule to run however often you want.

Documentation is included in the download.

Comments

  • Rob S
    Rob S Member CHOCOLATE MILK
    edited February 2021

    This works, but the temporary text file that's created doesn't get deleted. Can that be fixed?

  • Jeff Lorenzen
    Jeff Lorenzen Member CHOCOLATE MILK
    edited February 2021

    @Rob S, just add a line in your procedure to delete the temporary file after it's been read into the custom field.  

  • David Perhacs
    David Perhacs Member CHOCOLATE MILK
    edited February 2021

    Jeff is correct. I had taken it out of the original script for testing purposes and never put it back.

  • Rob S
    Rob S Member CHOCOLATE MILK
    edited February 2021

    Actually, the line is there, but it doesn't seem to work? (or at least it's not doing what it should).

  • Rob S
    Rob S Member CHOCOLATE MILK
    edited February 2021
    I figured it out - the line was there, but was just disabled (didn't realise that was a thing!) - but all now working as expected. Thanks!
  • Zach Perry
    Zach Perry Member CHOCOLATE MILK

    We've been using this for a few months and for the most part it works wonderfully (thank you!) but occasionally we get some false negatives. Devices will have the Bitlocker Status custom field set to "Not encrypted" however after running Get-BitlockerVolume is shows as FullyEncrypted and running the (Get-BitLockerVolume -MountPoint C).KeyProtector.recoverypassword command will print the key. Any ideas why this happens to a few? Running the procedure after verifying the commands results in a success then with no other comments (except for the skip unsupported OS steps) but the field doesn't change.

  • JesusShahid
    JesusShahid Member, IT Pro CHOCOLATE MILK

    We're using the cloud VSA, and are having trouble importing this XML. Are we missing something obvious?

    The file, if uploaded as an XML, just gives a genereic please upload an XML ex

  • Dave Woodfill
    Dave Woodfill Member CHOCOLATE MILK

    Im getting the same error as @JesusShahid

    Would love to start using this, any help is appreciated.

  • JPayne
    JPayne Member, Managed Service Provider CHOCOLATE MILK

    Hey @Dave Woodfill and @JesusShahid here is the fix to the procedure.

    https://helpdesk.kaseya.com/hc/en-gb/articles/4406508288529-How-to-Import-Agent-Procedures-after-9-5-7a......

    Remove the periods obviously but its has the tool required to fix the tags which aren't in the new procedure environment anymore. Once you run it on the .xml you can import it and run it successfully😀.

  • m.malina@zaanprimair.nl
    [email protected] Member CHOCOLATE MILK

    Hello,

    thanks for the nice script, used it already on on-premise but we step over to SAAS. Now we get error, when there is more then one key !

    FAILED in processing THEN step 3, Update System Info, with error Database access error, Failed SQL command: IF EXISTS (SELECT agentGuid FROM auditRsltManualFieldValues WHERE ((agentGuid = ?) AND (fieldNameFK IN (SELECT id FROM auditRsltManualFields WHERE ((fieldName = ?) AND (partitionId = (SELECT partitionId FROM machNameTab WHERE agentGuid = ?))))))) UPDATE auditRsltManualFieldValues SET fieldValue = ? WHERE ((agentGuid = ?) AND (fieldNameFK IN (SELECT id FROM auditRsltManualFields WHERE ((fieldName = (Line 22) 

    if copy the keys manuel it work (even it's long string )

    any help is appreciated

    Thanks

  • joefarage
    joefarage Member, IT Pro DECAF

    This worked great for us, thank you! It takes a couple minutes to process and update, so if you check the custom fields immediately after running the procedure, it may not show up yet. I had to follow the guide regarding the XML-Tool that JPayne commented about before I could import.

  • joefarage
    joefarage Member, IT Pro DECAF

    This worked great for us, thank you! It takes a couple minutes to process and update, so if you check the custom fields immediately after running the procedure, it may not show up yet. I had to follow the guide regarding the XML-Tool that JPayne commented about before I could import.

  • joefarage
    joefarage Member, IT Pro DECAF

    This worked great for us, thank you! It takes a couple minutes to process and update, so if you check the custom fields immediately after running the procedure, it may not show up yet. I had to follow the guide regarding the XML-Tool that JPayne commented about before I could import.

  • lshulz
    lshulz Member, Managed Service Provider CHOCOLATE MILK

    Works great thank you

  • lshulz
    lshulz Member, Managed Service Provider CHOCOLATE MILK

    Works great thank you

  • lshulz
    lshulz Member, Managed Service Provider CHOCOLATE MILK

    Works great thank you

  • lshulz
    lshulz Member, Managed Service Provider CHOCOLATE MILK

    Works great thank you

  • JPayne
    JPayne Member, Managed Service Provider CHOCOLATE MILK

    Hey @Dave Woodfill and @JesusShahid here is the fix to the procedure.

    https://helpdesk.kaseya.com/hc/en-gb/articles/4406508288529-How-to-Import-Agent-Procedures-after-9-5-7a......

    Remove the periods obviously but its has the tool required to fix the tags which aren't in the new procedure environment anymore. Once you run it on the .xml you can import it and run it successfully😀.

  • Ruppert Vernon
    Ruppert Vernon Member CHOCOLATE MILK

    We are having issues where sometimes the script fails on the first line when checking the OS type but also if there are multiple keys the custom field never updates. Has anyone come across this issue?

  • Ed Sirignano
    Ed Sirignano Member CHOCOLATE MILK

    Seeing the same issue as Ruppert with some failures when checking OS: if checkVar ("#vMachine.OsInfo#") Contains "Server"