#
Password-Generator.ps1
#
Table of Contents
Table of Contents Purpose Dependencies Function Usage Inputs Variables Command Line Flags Outputs Notes
#
Purpose
Interactively generates a secure 14-character password using a Windows Forms GUI, with capitals, symbols, and numbers in an easy-to-read format. Allows users to generate and copy passwords interactively.
#
Dependencies
- System.Windows.Forms
- System.Drawing
- Import-Csv
- Get-Random
- Set-Clipboard
- Four CSV files containing word lists:
4letter.csv
,5letter.csv
,6letter.csv
,7letter.csv
(each with aWord
column)
#
Function
- Displays a Windows Forms GUI with a description, generate button, password display box, and copy button.
- Loads word lists from four CSV files (4, 5, 6, and 7 letter words).
- When the user clicks "Generate":
- 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 (10-99 each, as a string).
- Adds a random symbol from a predefined set, placed before or after the numbers at random.
- Displays the generated password in the textbox.
- When the user clicks "Copy":
- Copies the password to the clipboard.
- Shows a pop-up message confirming the copy.
- If any CSV is missing or empty, outputs an error and exits.
#
Usage
Run directly to launch the GUI:
./Password-Generator.ps1
#
Inputs
- User interaction via the GUI (button clicks). No command-line parameters.
#
Variables
$form
,$descriptionLabel
,$button
,$passwordBox
,$copyButton
: Windows Forms controls.$4letter
,$5letter
,$6letter
,$7letter
: Paths to the CSV word lists.$list4
,$list5
,$list6
,$list7
: Arrays of words loaded from the CSVs.$randomCombination
,$word1
,$word2
,$combinedWords
: Used for password construction.$randomNumber1
,$randomNumber2
,$randomNumbers
: Random numbers for the password.$symbols
,$randomSymbol
,$symbolPlacement
,$password
: Used for symbol and final password logic.
#
Command Line Flags
None.
#
Outputs
- Displays the generated password in the GUI textbox.
- Copies the password to the clipboard when requested.
- Shows a pop-up message on successful copy.
- If a required CSV is missing or empty, outputs an error and exits.
#
Notes
- CSV file paths are hardcoded; update them as needed for your environment.
- Requires Windows and PowerShell 7+ for GUI and clipboard support.
- All output is accessible and uses EN-AU spelling.
- See project standards for robust root-based module import and error handling.