Unlock BitLocker protected drive with PowerShell

PowerShellI recently needed to unlock a HDD encrypted with BitLocker a number of times. I rapidly decided that entering the password manually every time was not something I wanted to do, so for that day, I needed a command line method of doing it. Fortunately, PowerShell has a commandlet available to do this:

$SecureString = ConvertTo-SecureString "{password}" -AsPlainText -Force
Unlock-BitLocker -MountPoint "X:" -Password $SecureString

The above came from the PowerShell section of the Microsoft Docs site.

The highlighted section, including braces, should be replaced with the password for the drive.

As the PowerShell script has to have the password embedded within it, this is not something I would recommend for every day use.