If you want to ensure the security of your accounts, an option is to use randomly generated passwords for each account together with a password manager tool (for example I use lastpass). In this way you will need to remember only one password (for the password manager account) and you can use very strong random passwords, that you don’t have to remember, for the rest of accounts.
In order to generate random passwords, I created the RandomPasswordGenerator, which is a simple Powershell Module that you can use for generating one or more random passwords.
The first thing you need to do for using it is to install the module from the Powershell Gallery. You can do this with the following commands:
$ModuleName = "RandomPasswordGenerator" Get-Module -Name $ModuleName -ListAvailable | Uninstall-Module Install-Module $ModuleName -Force -Confirm:$false
After the module is installed (only once) you can use the function “Get-RandomPassword” in any powershell session. You can also use the help cmdlet to see information about this function and examples of how to use it:
Get-Help Get-RandomPassword -Full
If you don’t want to install it, you can download the “RandomPasswordGenerator.psm1” from the GitHub Repository and import it when you want to generate random passwords:
Import-Module "yourlocalfolder\RandomPasswordGenerator.psm1"
I know there are many websites and also other Powershell modules that can be used for generating random passwords, but I created my own module because I wanted to be able to control the structure of the passwords: what percents of upper case, lower case letter, numbers and special characters the passwords will contain. Also, by using this module it is possible to generate very quick a large number of passwords, for example 10.000 or more. And to be honest, the first reason why I created this simple module was for fun and practice 🙂
Next let’s see some examples of how the function can be used.
Example 1:
#Use defaults: 1 password, 15 chars, default percents: 25% upper case letters, 25% lower case letters, 30% numbers and 20% special characters. Get-RandomPassword
Example 2:
#Get 1 password with custom number of characters, default percents Get-RandomPassword -PasswordLength 9
Example 3:
#Open TempFile in Notepad (multiple passwords) and change password structure(30% lower case letters, 30% upper case, 20% numbers, 20% special characters): Get-RandomPassword -PasswordLength 15 ` -NoOfPasswords 50 ` -PercentLowerCaseLetters 0.3 ` -PercentUpperCaseLetters 0.3 ` -PercentNumbers 0.2 ` -PercentCharacters 0.2 ` -OpenInTextFile
Example 4:
#Generate Passwords without Upper Case Letters and Special Characters Get-RandomPassword -PasswordLength 10 ` -NoOfPasswords 30 ` -PercentLowerCaseLetters 0.5 ` -PercentNumbers 0.5
Example 5:
#If you change a percent, you need to input Percents that sum 1 Get-RandomPassword -PasswordLength 10 ` -NoOfPasswords 1 ` -PercentLowerCaseLetters 0.5
Example 6:
#get a large number of passwords and open in temp txt file Get-RandomPassword -NoOfPasswords 7000 -OpenInTextFile
Example 7:
#get only the passwords, without the column PasswordId Get-RandomPassword -NoOfPasswords 10 | ForEach-Object {$_.PasswordValue}
I hope you like this simple example of random password generator and you will use it. Any feedback about is welcome in the comments of this post or on GitHub repository: https://github.com/andreilungu/RandomPasswordGenerator