Skip to content

Instantly share code, notes, and snippets.

@mardahl
Created March 14, 2022 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mardahl/32aa727fd1025a8e170c4b39b3a2a62f to your computer and use it in GitHub Desktop.
Save mardahl/32aa727fd1025a8e170c4b39b3a2a62f to your computer and use it in GitHub Desktop.
Generate random bitlocker recovery keys
#Generates 100 random bitlocker recovery key ID and keys
#By Michael Mardahl github.com/mardahl
#Use it for whatever...
$hash = @{}
for($i = 0;$i -lt 100;$i++) {
$id = "$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})-$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})-$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})-$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})-$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})$((97..102) | Get-Random -Count 1 | % {[char]$_})$(Get-Random -minimum 10 -maximum 99)$((97..102) | Get-Random -Count 1 | % {[char]$_})"
$key = "$(Get-Random -minimum 100000 -maximum 999999)-$(Get-Random -minimum 100000 -maximum 999999)-$(Get-Random -minimum 100000 -maximum 999999)-$(Get-Random -minimum 100000 -maximum 999999)-$(Get-Random -minimum 100000 -maximum 999999)-$(Get-Random -minimum 100000 -maximum 999999)-$(Get-Random -minimum 100000 -maximum 999999)-$(Get-Random -minimum 100000 -maximum 999999)"
$hash[$id]=$key
}
#output
$hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment