Enable BitLocker + BitLocker Key Recovery All through PowerShell

Very Important :

If you don’t have a way of immediately saving the BitLocker key in a safe place, there’s no need to run the script, as you’ll later be forced to format the disk and lose all your data.

Prerequisites :

Check if BitLocker module is installed :

Get-WindowsFeature -Name BitLocker

The X mean that BitLocker Feature is already installed :

otherwise, Install BitLocker Module if is not installed (reboot is required after installation) :

Install-WindowsFeature -Name BitLocker -IncludeAllSubFeature -IncludeManagementTools

1 – Enable BitLocker through PowerShell :

Here is PowerShell script :

#Enable bitlocker withTPM and prints the new recovery key to the console.

reagentc /enable

$EnableBitlocker = Enable-Bitlocker -MountPoint $($ENV:SystemDrive) -UsedSpaceOnly -RecoveryPasswordProtector 

After executing the script machine will reboot.

Here we can see Bitlocker Enabled after the reboot :

2 – BitLocker Key Recovery through PowerShell :

if you want to recover the Bitlocker Key, you need just to execute this script.

Script must be executed as administrator or system Level.

# Recover BitLocker Key
$Resume = get-bitlockervolume | Resume-Bitlocker

((get-bitlockervolume).KeyProtector | Where-Object -property keyprotectortype -eq RecoveryPassword |   select-object -last 1).recoverypassword

Thanks

Aymen EL JAZIRI (Microsoft MVP)
Aymen EL JAZIRI (Microsoft MVP)

Hi, I’m Aymen El Jaziri , a passionate System Administrator and Microsoft MVP, with years of hands-on experience in managing and securing modern IT infrastructures.
This blog is where I share technical guides, automation scripts, product reviews, and real-world solutions that help IT professionals simplify their day-to-day work and stay ahead in a fast-evolving cloud ecosystem.
Whether you’re here to troubleshoot an issue, improve your automation game, or learn new best practices , welcome in my blog !
Let’s build a stronger, smarter IT community together.
Feel free to connect with me on LinkedIn for more content, discussions, or collaboration opportunities.

Thanks

Aymen

Articles: 154