Skip to content

New-Pins

Generates new PIN's

param([int]$pinLength = 5, [int]$columns = 15, [int]$rows = 27)

try {
	$generator = New-Object System.Random
	for ($i = 0; $i -lt $rows; $i++) {
		$line = ""
		for ($j = 0; $j -lt $columns; $j++) {
			for ($k = 0; $k -lt $pinLength; $k++) {
				$line += [char]$generator.next(48,57) # 48='0', 57='9'
			}
			$line += "   "
		}
		Write-Output $line
	}
	exit 0 # success
} catch {
	"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
	exit 1
}

Specifies the PIN length (default: 5)

Specifies the number of columns (default: 15)

Specifies the number of rows (default: 27)

An interactive directory of PowerShell scripts.