User Tools

Site Tools


windows:windows10:scripts:bitlockerdecrypt

Decrypt / Unlock Bitlocker drives

It takes forever to unlock drives via GUI, so I wrote this script to do this via script/ Powershell.
Line 1 will print all drives to see which are encrypted. You need to execute as admin to show this, if you know your drives and just want to unlock, remove this line and run the script as normal user.
Upcoming updates: Unlock all locked drives at once

unlockbitlocker.ps1
Get-BitlockerVolume
 
$Title = ""
$Message = "What do you want to do?"
$Decrypt = New-Object System.Management.Automation.Host.ChoiceDescription "&Decrypt", "Decrypt"
$Encrypt = New-Object System.Management.Automation.Host.ChoiceDescription "&Encrypt", "Encrypt"
$Exit = New-Object System.Management.Automation.Host.ChoiceDescription "&Exit", "Exit"
$Options = [System.Management.Automation.Host.ChoiceDescription[]]($Decrypt, $Encrypt, $Exit)
 do {
    $Action = $host.ui.PromptForChoice($title, $message, $options, 0) 
    switch($Action)
    {
        0 {$Drive = Read-Host -Prompt 'Which drive do you want to decrypt?'; Unlock-BitLocker -MountPoint $Drive":" -Password (Read-Host "Enter your password:" -AsSecureString)}
        1 {$Drive = Read-Host -Prompt 'Which drive do you want to encrypt?'; Lock-BitLocker -MountPoint $Drive":"}
        2 {Write-Host "Exiting script";Start-Sleep -Seconds 3}
    }
} While ($Action -ne 2)
windows/windows10/scripts/bitlockerdecrypt.txt · Last modified: 2019/09/18 20:22 by lunetikk