Last active
December 20, 2018 23:36
-
-
Save dstreefkerk/0e2e78bb16edcc78467e0dbc75ad0a9a to your computer and use it in GitHub Desktop.
A quick function to replicate some of the functionality of http://correcthorsebatterystaple.net/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-RandomPassword { | |
[OutputType([string])] | |
Param | |
( | |
[int] | |
$Count = 1, | |
[string] | |
$Separator = '-' | |
) | |
$words = (Invoke-WebRequest 'https://bitbucket.org/jvdl/correcthorsebatterystaple/raw/773dbccc9b9e1320f076c432d600f19785c41792/data/wordlist.txt' | Select-Object -ExpandProperty Content).Split(',') | |
1..$Count | ForEach-Object {"$([string]::Join($Separator,(1..4 | ForEach-Object {[cultureinfo]::CurrentCulture.TextInfo.ToTitleCase(($words | Get-Random))})))$Separator$(1..99 | Get-Random)"} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment