Bitlocker script to unlock drive

command, windows

Solution

Kind of late to the party but as mentioned here you can easily do this with only a couple of lines, if you don't have any problem using PowerShell:

PS C:\> $SecureString = ConvertTo-SecureString "fjuksAS1337" -AsPlainText -Force
PS C:\> Unlock-BitLocker -MountPoint "E:" -Password $SecureString

Problem

What I am trying to achieve is to create a very small script to unlock my bitlocker drive, using the password, not the recovery password. There is a Microsoft command for that, which is: ``` manage-bde -unlock D: -password ``` where `D` is my bit locker drive. If I run this command line it will ask me for the password, and then the drive is properly unlocked. At first I thought about creating a variable to ask for the password to the user, and then use this variable in the above command line, so that the script would look like: ``` set /p pass= what is your pass manage-bde -unlock D: -password %pass% ``` The problem is that `-password` does not seem to accept any argument, would it be the variable, or the password in clear, it will fail. So, the only way to make it work seems to be an automatic reply to the prompt for the password, with the data in the variable. But I don't know how to do that. I assume there is an extra command line to add after the `manage-dbe`... My programming skills are quite weak, so any help would be appreciated.

Original source