A simple password generator to get away from people using CompanyNameYear formats and variations of Password – This is by no means meant to be a super secure way of generating passwords and I am aware of the inherent risks of using get random. This is simply a way to generate a password for an end user that will be awkward enough that they change it immediately whilst getting away from people setting password2017! and similar.

Download Here:

PasswordGenerator

Prerequisites:

.NET 4.5

WMF 5.1

Sapien Powershell Studio Code



$MainForm_Load={

}

$Generate_Click={

#Validate Length

If ($length.Text -lt "1")

{

[System.Windows.Forms.MessageBox]::Show('Password length cannot be zero', 'Error', 'OK', 'Error')

}

#All

elseif ($UpperCase.Checked -eq $true -and $LowerCase.Checked -eq $true -and $Numbers.Checked -eq $true -and $Symbols.Checked -eq $true -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(33 .. 47 + 58 .. 64 + 91 .. 95 + 123 .. 126 + 49 .. 57 + 65 .. 72 + 74 .. 78 + 80 .. 90 + 97 .. 104 + 106 .. 107 + 109 .. 110 + 112 .. 122) -Count $Length.Text)) -join ""

}

#ALLExclude UC

elseif ($UpperCase.Checked -eq $false -and $LowerCase.Checked -eq $true -and $Numbers.Checked -eq $true -and $Symbols.Checked -eq $true -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(33 .. 47 + 58 .. 64 + 91 .. 95 + 123 .. 126 + 49 .. 57 + 97 .. 104 + 106 .. 107 + 109 .. 110 + 112 .. 122) -Count $Length.Text)) -join ""

}

#ALLExclude LC

elseif ($UpperCase.Checked -eq $true -and $LowerCase.Checked -eq $false -and $Numbers.Checked -eq $true -and $Symbols.Checked -eq $true -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(33 .. 47 + 58 .. 64 + 91 .. 95 + 123 .. 126 + 49 .. 57 + 65 .. 72 + 74 .. 78 + 80 .. 90) -Count $Length.Text)) -join ""

}

#ALLExclude Num

elseif ($UpperCase.Checked -eq $true -and $LowerCase.Checked -eq $true -and $Numbers.Checked -eq $false -and $Symbols.Checked -eq $true -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(33 .. 47 + 58 .. 64 + 91 .. 95 + 123 .. 126 + 65 .. 72 + 74 .. 78 + 80 .. 90 + 97 .. 104 + 106 .. 107 + 109 .. 110 + 112 .. 122) -Count $Length.Text)) -join ""

}

#ALLExclude Sym

elseif ($UpperCase.Checked -eq $true -and $LowerCase.Checked -eq $true -and $Numbers.Checked -eq $true -and $Symbols.Checked -eq $false -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(49 .. 57 + 65 .. 72 + 74 .. 78 + 80 .. 90 + 97 .. 104 + 106 .. 107 + 109 .. 110 + 112 .. 122) -Count $Length.Text)) -join ""

}

#Num and Sym

elseif ($UpperCase.Checked -eq $false -and $LowerCase.Checked -eq $false -and $Numbers.Checked -eq $true -and $Symbols.Checked -eq $true -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(33 .. 47 + 58 .. 64 + 91 .. 95 + 123 .. 126 + 49 .. 57) -Count $Length.Text)) -join ""

}

#LC and Sym

elseif ($UpperCase.Checked -eq $false -and $LowerCase.Checked -eq $true -and $Numbers.Checked -eq $false -and $Symbols.Checked -eq $true -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(33 .. 47 + 58 .. 64 + 91 .. 95 + 123 .. 126 + 97 .. 104 + 106 .. 107 + 109 .. 110 + 112 .. 122) -Count $Length.Text)) -join ""

}

#LC and Num

elseif ($UpperCase.Checked -eq $false -and $LowerCase.Checked -eq $true -and $Numbers.Checked -eq $true -and $Symbols.Checked -eq $false -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(97 .. 104 + 106 .. 107 + 109 .. 110 + 112 .. 122 + 49 .. 57) -Count $Length.Text)) -join ""

}

#UC and Sym

elseif ($UpperCase.Checked -eq $true -and $LowerCase.Checked -eq $false -and $Numbers.Checked -eq $false -and $Symbols.Checked -eq $true -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(33 .. 47 + 58 .. 64 + 91 .. 95 + 123 .. 126 + 65 .. 72 + 74 .. 78 + 80 .. 90) -Count $Length.Text)) -join ""

}

#UC and Num

elseif ($UpperCase.Checked -eq $true -and $LowerCase.Checked -eq $false -and $Numbers.Checked -eq $true -and $Symbols.Checked -eq $false -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(49 .. 57 + 65 .. 72 + 74 .. 78 + 80 .. 90) -Count $Length.Text)) -join ""

}

#UC and LC

elseif ($UpperCase.Checked -eq $true -and $LowerCase.Checked -eq $true -and $Numbers.Checked -eq $false -and $Symbols.Checked -eq $false -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(65 .. 72 + 74 .. 78 + 80 .. 90 + 97 .. 104 + 106 .. 107 + 109 .. 110 + 112 .. 122) -Count $Length.Text)) -join ""

}

#Sym

elseif ($UpperCase.Checked -eq $false -and $LowerCase.Checked -eq $false -and $Numbers.Checked -eq $false -and $Symbols.Checked -eq $true -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(33 .. 47 + 58 .. 64 + 91 .. 95 + 123 .. 126) -Count $Length.Text)) -join ""

}

#Num

elseif ($UpperCase.Checked -eq $false -and $LowerCase.Checked -eq $false -and $Numbers.Checked -eq $true -and $Symbols.Checked -eq $false -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(49 .. 57) -Count $Length.Text)) -join ""

}

#LC

elseif ($UpperCase.Checked -eq $false -and $LowerCase.Checked -eq $true -and $Numbers.Checked -eq $false -and $Symbols.Checked -eq $false -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(97 .. 104 + 106 .. 107 + 109 .. 110 + 112 .. 122) -Count $Length.Text)) -join ""

}

#UC

elseif ($UpperCase.Checked -eq $true -and $LowerCase.Checked -eq $false -and $Numbers.Checked -eq $false -and $Symbols.Checked -eq $false -and $length.Text -gt "0")

{

$Password = ([char[]](Get-Random -Input $(65 .. 72 + 74 .. 78 + 80 .. 90) -Count $Length.Text)) -join ""

}

#None

elseif ($lowercase.Checked -eq $false -and $UpperCase.Checked -eq $false -and $Symbols.Checked -eq $false -and $Numbers.Checked -eq $false)

{

[System.Windows.Forms.MessageBox]::Show('Character types cannot be blank. Please select at least one.', 'Error', 'OK', 'Error')

}

$Output.text = $Password

}

$Exit_Click={

$MainForm.Close()

}

$buttonCopy_Click={

$Output.Text | clip

}

$toolstripstatuslabel2_Click={

[System.Diagnostics.Process]::Start($toolstripstatuslabel2.Tag)

}





Like Loading...