C
Size: a a a
C
AS
MO
4
4
RV
MO
MO
4
4
$series = @{
LowerCase = [Char[]]'abcdefghijklmnopqrstuvwxyz'
Numbers = [Char[]]'0123456789'
Symbols = [Char[]]'!@#$%^&*()_+'
UpperCase = [Char[]]'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
}
function Get-Password {
[CmdletBinding()]
param (
[Int]$size = 8,
[ArgumentCompleter( { @( $series.keys ) -match $args[2] })]
[ValidateScript( { if ( $PSItem -in $series.keys ) { $true }
else { throw "No such Case" } } )]
[string[]]$complexity = $series.keys,
[Char[]]$exclude
)
$result = $tokens = @()
($complexity | Sort-Object -Unique ).foreach{
$choice = $series[$PSItem].where{ $PSItem -cnotin $exclude }
$result += $choice | Get-Random
$tokens += $choice
}
while ( $result.Count -lt $size ) { $result += $tokens | Get-Random }
( $result | Sort-Object { Get-Random } ) -Join ""
}
m
(1..8 | % {[char](Get-Random -Minimum 33 -Maximum 124)}) -join ""а так фу?)
4
S
as
MO
S
S
4
S
4