update
This commit is contained in:
20
General/Get-RandomPassword.ps1
Normal file
20
General/Get-RandomPassword.ps1
Normal file
@ -0,0 +1,20 @@
|
||||
function Get-RandomPassword {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[int] $LettersLowerCase = 4,
|
||||
[int] $LettersHigherCase = 2,
|
||||
[int] $Numbers = 1,
|
||||
[int] $SpecialChars = 0,
|
||||
[int] $SpecialCharsLimited = 1
|
||||
)
|
||||
$Password = @(
|
||||
Get-RandomCharacters -length $LettersLowerCase -characters 'abcdefghiklmnoprstuvwxyz'
|
||||
Get-RandomCharacters -length $LettersHigherCase -characters 'ABCDEFGHKLMNOPRSTUVWXYZ'
|
||||
Get-RandomCharacters -length $Numbers -characters '1234567890'
|
||||
Get-RandomCharacters -length $SpecialChars -characters '!$%()=?{@#'
|
||||
Get-RandomCharacters -length $SpecialCharsLimited -characters '!$#'
|
||||
)
|
||||
$StringPassword = $Password -join ''
|
||||
$StringPassword = ($StringPassword.ToCharArray() | Get-Random -Count $StringPassword.Length) -join ''
|
||||
return $StringPassword
|
||||
}
|
Reference in New Issue
Block a user