Created
November 29, 2017 15:47
-
-
Save jschlackman/4a71c618fdc3aa705b1c0853ff4e63e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name: Create-BulkRandomPasswords.ps1 | |
# Author: James Schlackman | |
# Last Modified: Nov 11 2017 | |
# | |
# Creates a text file containing a bulk number of passwords made up of a specified length of random | |
# alphanumerics and special characters. | |
$PassLength = 16 | |
$NumPasswords = 253 | |
$OutputPath = "BulkRandomPasswords.txt" | |
# Define allowed characters | |
$UpperCase = "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z" | |
$LowerCase = "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z" | |
$Numbers = "1","2","3","4","5","6","7","8","9","0" | |
$Special = "!","$","%","&","(",")","*","+","-","/",":",";","<","=",">","?","@","[","\","]","^","_","{","}","~" | |
$AllChars = $UpperCase + $LowerCase + $Numbers + $Special | |
# Initialize array to store the passwords | |
$NewPasswords = @("") * $NumPasswords | |
# Fill each array element with a random password of the specified length | |
For ($PassCount = 0; $PassCount -lt $NumPasswords; $PassCount++) { | |
$NewPass = "" | |
While ($NewPass.Length -lt $PassLength) {$NewPass = $NewPass + (Get-Random $AllChars)} | |
$NewPasswords[$PassCount] = $NewPass | |
} | |
# Output array to file | |
$NewPasswords | Out-File -FilePath $OutputPath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment