I want the script to generate a random last group (Key0
) and try to unlock the drive on each iteration with the concatenated string (Key
), but is not working.
I execute the script and it just makes one try. It seems the while is not working.
Do {
$Hash0 = 0..5 | % {Get-Random -Minimum 0 -Maximum 9 }
$Key0 = $Hash0 -join ""
$Key = "175615-666567-468105-046717-174922-139634-579799-"+$Key0
manage-bde.exe -unlock H: -recoverypassword $Key >$null
$Status = Get-BitlockerVolume -MountPoint "H:"
} while($Status.CapacityGB -ne "0")
I'm not a Powershell expert.