Skip to content

Instantly share code, notes, and snippets.

@SpotlightForBugs
Created December 28, 2024 12:15
Show Gist options
  • Save SpotlightForBugs/b98116871fa43b4133f45a586a978346 to your computer and use it in GitHub Desktop.
Save SpotlightForBugs/b98116871fa43b4133f45a586a978346 to your computer and use it in GitHub Desktop.
# Get-BitLockerVolume | ForEach-Object { Disable-BitLocker -MountPoint $_.MountPoint } # if you want to decrypt all drives
while ($true) {
# Run manage-bde -status and process line by line
cmd /c 'manage-bde -status' | ForEach-Object {
# If the line indicates a Volume line, just display it
if ($_ -match '^Volume [A-Z]:') {
Write-Host $_
}
# If the line shows the Percentage Encrypted, parse & compute decryption
elseif ($_ -match 'Percentage Encrypted') {
# Extract the numeric portion (including decimals if present)
$match = [regex]::Match($_, '(\d+(\.\d+)?)%')
if ($match.Success) {
$encryptedValue = [double]$match.Groups[1].Value
$decryptedValue = 100 - $encryptedValue
Write-Host "Decryption State: $decryptedValue%"
}
}
}
# Sleep for 5 seconds before repeating
Start-Sleep -Seconds 5
clear
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment