New-Passwords
Generates new passwords
param([int]$passwordLength = 16, [int]$columns = 6, [int]$rows = 27)
try {
[int]$minCharCode = 33
[int]$maxCharCode = 126
$generator = New-Object System.Random
for ([int]$row = 0; $row -lt $rows; $row++) {
$line = ""
for ([int]$col = 0; $col -lt $columns; $col++) {
for ([int]$i = 0; $i -lt $passwordLength; $i++) {
$line += [char]$generator.next($minCharCode, $maxCharCode)
}
$line += " "
}
Write-Output $line
}
exit 0 # success
} catch {
"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1
}Specifies the length of the password (default: 16)
Specifies the number of columns (default: 6)
Specifies the number of rows (default: 27)