Generate complex password in two strings in Powershell

Usually, I generate passwords for my users by closing my eyes and chaotically pressing the buttons on keyboard. There is a new way now - I can generate it in Powershell easily:

$pw = [char[]]"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!%&*+()=?|<>_-@$"
{($pw | Get-Random -Count 12) -join ""}

That will be a single password from 12 chars.
Also you can action like that:

(1..100) | ForEach({($pw | Get-Random -Count 12) -join ""})

And this will be one hundred (100) of passwords.

Tags: script, powershell (ru)


Add comment

Security code