I am using the following PowerShell code to encrypt a drive. When I run it's it gives the following output and I am not able to assign it to a variable. It does not seem like a regular output. Any help is appreciated.
Code:
Enable-BitLocker -MountPoint $MountPoint -EncryptionMethod Aes256 -UsedSpaceOnly -RecoveryPasswordProtector
Output:
WARNING: ACTIONS REQUIRED:
1. Save this numerical recovery password in a secure location away from your computer:
405273-201047-403040-618189-117755-037620-586223-109186
To prevent data loss, save this password immediately. This password helps ensure that you can unlock the encrypted volume.

After you have run that command to encrypt the drive, you can get the key via:
(Get-BitLockerVolume -MountPoint D:).KeyProtector.RecoveryPasswordYou just need to replace the drive: D: with the drive you encrypted. Note though this is only for this type of manual password recovery. In a domain environment its better to backup the key to Active Directory rather than keeping it just as txt file somewhere.