22 lines
598 B
PowerShell
22 lines
598 B
PowerShell
# Password Settings
|
|
$PasswordLength = 8
|
|
$password = ""
|
|
# Set Password Character Strings
|
|
$Set0 = "abcdefghijklmnpqrstuvwxyz".ToCharArray()
|
|
$Set1 ="123456789".ToCharArray()
|
|
$Set2 = "ABCDEFGHIJKLMNPQRSTUVWXYZ".ToCharArray()
|
|
$Set3 = "!£$%^&()_ @#".ToCharArray()
|
|
|
|
# Build Password on Length Variable
|
|
do{
|
|
|
|
$password += $set0 | Get-Random;
|
|
$password += $set1 | Get-Random;
|
|
$password += $set2 | Get-Random;
|
|
$password += $set3 | Get-Random;
|
|
}
|
|
until ($password.Length -eq $passwordlength)
|
|
# Convert to Secure String
|
|
$pwd = convertto-securestring $password -asplaintext -force
|
|
# Display Password
|
|
$password |