Janik von Rotz


1 min read

Password Generator with PowerShell

Whenever I had to think of a secure password I followed these steps:

As I’am using a PowerShell a lot I’ve created the function/script below to create such a password.

function Get-RandomPasswort{
    
    $numbers = 1..9
    $consonants = "b","c","d","f","g","h","k","l","m","n","p","r","s","t","v","w","x","z"
    $nopeletters = "j","q","y"
    $vocals = "a","e","i","o","u"
    $dotsandstuff = ",",".","-"
    $nopedotsandstuff = ";",":","_"

    return (Get-Random $consonants).ToString().ToUpper() + 
    (Get-Random $vocals) + 
    (Get-Random $consonants) + 
    (Get-Random $numbers) +  
    (Get-Random $numbers) + 
    (Get-Random $numbers) + 
    (Get-Random $vocals) + 
    (Get-Random $consonants) + 
    (Get-Random $vocals) + 
    (Get-Random $dotsandstuff)
}

Get the lastest version of this snippet here: https://gist.github.com/f437d7764a43b9de6c3a

Example

Create 10 new password is easily done.

1..10 | %{Get-RandomPasswort}
Zov683oxa.
Pev541imi-
Pim276ovo-
Vus211ixi.
Dab998inu.
Dup268awi.
Det893ema.
Xok762axa-
Lun996azu,
Gal196ere.

Categories: scripting
Tags: generator , password , powershell , security
Improve this page
Show statistic for this page