PowerShell: Random Password Generator.
Quick little script to generate a password meeting simple complexity (guaranteed one upper and one number at random positions in the string) guidelines.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | $upper = 65..90 | ForEach-Object { [char]$_ } $lower = 97..122 | ForEach-Object { [char]$_ } $number = 48..57 | ForEach-Object { [char]$_ } $total += $upper $total += $number $total += $lower $rand = "" $i = 0 while( $i -lt 10){ $rand += $total | Get -Random ; $i ++ } "Initial: " + $rand $rand = $rand .ToCharArray() $num = 1.. $rand .Count | Get -Random $up = $num while( $up -eq $num ){ $up = 1.. $rand .Count | Get -Random } "num " + $num "up " + $up $rand [( $num -1)] = $number | Get -Random $rand [( $up -1)] = $upper | Get -Random $rand = $rand -join "" "Final: " + $rand |