Skip to content

Commit

Permalink
added check for tpm
Browse files Browse the repository at this point in the history
  • Loading branch information
redanthrax committed Mar 19, 2024
1 parent 27c365f commit 36c57da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts_wip/Win_ManageBitlocker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ function Win_ManageBitlocker {
Write-Output "Volume already encrypted or in process"
}

#Check for recovery password, add if missing
#Check for recovery password, add if missing and we have Tpm
$tpmProtector = $vol.KeyProtector | Where-Object { $_.KeyProtectorType -eq "Tpm" }
$recoveryPassword = $vol.KeyProtector | Where-Object { $_.KeyProtectorType -eq "RecoveryPassword" }
if (-Not($recoveryPassword)) {
if (-Not($recoveryPassword) -and $tpmProtector) {
Write-Output "Adding recovery password"
$vol | Add-BitLockerKeyProtector -RecoveryPasswordProtector -InformationAction SilentlyContinue | Out-Null
}
Expand Down

0 comments on commit 36c57da

Please sign in to comment.