2021-08-26 10:46:12 +02:00
|
|
|
|
<#
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.SYNOPSIS
|
2021-08-19 17:08:09 +02:00
|
|
|
|
list-pins.ps1 [<pin-length>] [<columns>] [<rows>]
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.DESCRIPTION
|
|
|
|
|
Prints a list of random PIN's
|
|
|
|
|
.EXAMPLE
|
2021-08-19 17:08:09 +02:00
|
|
|
|
PS> .\list-pins.ps1
|
2021-07-13 21:10:02 +02:00
|
|
|
|
.LINK
|
|
|
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
|
.NOTES
|
2021-08-03 15:53:57 +02:00
|
|
|
|
Author: Markus Fleschutz
|
|
|
|
|
License: CC0
|
2020-12-29 15:14:21 +01:00
|
|
|
|
#>
|
2020-12-22 10:12:50 +01:00
|
|
|
|
|
2021-08-19 17:08:09 +02:00
|
|
|
|
param([int]$PinLength = 5, [int]$Columns = 12, [int]$Rows = 30)
|
2020-12-22 10:12:50 +01:00
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
write-output ""
|
2021-04-14 13:52:19 +02:00
|
|
|
|
$Generator = New-Object System.Random
|
2020-12-29 15:14:21 +01:00
|
|
|
|
for ($j = 0; $j -lt $Rows; $j++) {
|
2020-12-22 10:12:50 +01:00
|
|
|
|
$Line = ""
|
|
|
|
|
for ($k = 0; $k -lt $Columns; $k++) {
|
2021-04-14 13:52:19 +02:00
|
|
|
|
for ($i = 0; $i -lt $PinLength; $i++) {
|
|
|
|
|
$Line += [char]$Generator.next(48,57)
|
|
|
|
|
}
|
2020-12-22 10:12:50 +01:00
|
|
|
|
$Line += " "
|
|
|
|
|
}
|
|
|
|
|
write-output $Line
|
|
|
|
|
}
|
|
|
|
|
write-output ""
|
|
|
|
|
exit 0
|
|
|
|
|
} catch {
|
2021-05-02 21:30:48 +02:00
|
|
|
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2020-12-22 10:12:50 +01:00
|
|
|
|
exit 1
|
|
|
|
|
}
|