Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for more than one Bitlocker key per volume #8

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions Invoke-EscrowBitlockerToAAD.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,20 @@ function Get-KeyProtectorId ($BitlockerDrive) {

function Invoke-BitlockerEscrow ($BitlockerDrive,$BitlockerKey) {
#Escrow the key into Azure AD
try {
BackupToAAD-BitLockerKeyProtector -MountPoint $BitlockerDrive -KeyProtectorId $BitlockerKey -ErrorAction SilentlyContinue
Write-Output "Attempted to escrow key in Azure AD - Please verify manually!"
exit 0
} catch {
Write-Error "This should never have happend? Debug me!"
exit 1

foreach ($Key in $BitlockerKey) {

try {
BackupToAAD-BitLockerKeyProtector -MountPoint $BitlockerDrive -KeyProtectorId $Key #-ErrorAction SilentlyContinue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add -ErrorAction Stop to make sure the catch kicks in.

Write-Output "Attempted to escrow key in Azure AD - Please verify manually!"

} catch {
Write-Error "This should never have happend? Debug me!"
exit 1
}

}
exit 0
}

#endregion functions
Expand Down