#
Password-Generator-Silent.ps1
#
Table of Contents
Table of Contents Purpose Dependencies Function Usage Inputs Variables Command Line Flags Outputs Notes
#
Purpose
Generates a strong password silently for use in automation or scripts, using random words, numbers, and symbols for complexity.
#
Dependencies
- Four CSV files containing word lists:
4letter.csv,5letter.csv,6letter.csv,7letter.csv(each with aWordcolumn) - Import-Csv
- Get-Random
#
Function
- Loads word lists from four CSV files (4, 5, 6, and 7 letter words).
- Randomly selects either a 4+7 or 5+6 letter word combination.
- Capitalises the first letter of each word and concatenates them.
- Appends two random numbers (0-9 each, as a string).
- Adds a random symbol from a predefined set, placed before or after the numbers at random.
- Returns the generated password as a string.
- If any CSV is missing or empty, outputs an error message and returns nothing.
#
Usage
Run directly to output a password:
# in a script:
$password = & "C:\Path\To\Password-Generator-Silent.ps1"
#
Inputs
None (all configuration is internal; ensure the required CSV files exist at the specified paths).
#
Variables
$4letter,$5letter,$6letter,$7letter: Paths to the CSV word lists.$list4,$list5,$list6,$list7: Arrays of words loaded from the CSVs.$randomCombination: Determines which word length combination to use.$word1,$word2: The randomly selected words.$randomNumber1,$randomNumber2: Random digits for the password.$symbols: String of allowed symbols.$randomSymbol: The randomly selected symbol.$symbolPlacement: Determines symbol position in the password.$password: The final generated password.
#
Command Line Flags
None.
#
Outputs
- Outputs a generated password as a string (to the pipeline or variable).
- If a required CSV is missing or empty, outputs an error message and returns nothing.
#
Notes
- CSV file paths are hardcoded; update them as needed for your environment.
- All output is accessible and uses EN-AU spelling.
- See project standards for robust root-based module import and error handling.