Thanks for this script/ solution. Thanks to this I learned a lot about how to do BitLocker with PowerShell from Intune MDM. I've added some functionality and made some fixes and design changes, but can't release all the code here due to the fact that I've done this for my company, and it's their IP.
That being said, I'd like to share a fix to one part that failed for me some times: Fetching the certificate for uploading recovery password to Azure AD using REST.
I rewrote it to this, might be usefull for others:
# Get the AAD Machine Certificate
$Certificate = $([array]$(Get-ChildItem -Path 'Certificate::LocalMachine\My').Where{$_.'Issuer' -match 'CN=MS-Organization-Access'})
$CertificateThumbprint = [string]$($Certificate | Select-Object -ExpandProperty 'Thumbprint')
$CertificateSubject = [string]$([string]$($Certificate | Select-Object -ExpandProperty 'Subject').Replace('CN=',''))
# Get tenant domain name from registry
$TenantDomain = [string]$([string]$(Get-ItemProperty -Path ('Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\JoinInfo\{0}' -f ($CertificateThumbprint)) -Name 'UserEmail' | Select-Object -ExpandProperty 'UserEmail').Split('@')[-1])
Offtopic: How do I set a profile picture? I've searched the forum and Google-ed it too.