#
User-Creation.ps1
Purpose Dependencies Function Usage Inputs Variables Command Line Flags Outputs Notes
#
Purpose
Automates the creation of Active Directory user accounts with a graphical user interface (GUI). Collects user information, validates input, generates a random password, creates the AD user, configures mailbox, group memberships, employee ID, and organisational structure. Provides user feedback and password delivery via pop-ups and clipboard.
#
Dependencies
- Active Directory module (Microsoft Docs)
- Exchange Online Management module (Microsoft Docs)
- Windows Forms (part of .NET, used for GUI)
- Password-Generator-Silent.ps1 (local script, must be accessible and dot-sourced)
#
Function
- Loads required modules (Active Directory, Exchange Online Management).
- Presents a Windows Forms GUI for user input (first name, last name, employee ID, manager, mirror user, job title, department).
- Validates all fields before allowing user creation.
- Generates a random password using an external password generator script.
- Creates the AD user with all required attributes and home directory.
- Copies group memberships from a specified mirror user.
- Enables an Exchange Online mailbox for the new user.
- Ensures membership in required base groups and removes from non-standard signature groups.
- Displays the new credentials in a pop-up and copies the password to clipboard.
- Includes buttons to clear fields for ease of repeated use.
#
Usage
./User-Creation.ps1
The script is fully interactive and uses a GUI. No command-line parameters are required for standard use.
#
Inputs
- User input via GUI: First Name, Last Name, Employee ID, Manager, Mirror User, Job Title, Department (dropdown)
#
Variables
$textBoxFirstName
,$textBoxLastName
,$textBoxEmployeeID
,$textBoxManager
,$textBoxMirrorUser
,$textBoxJobTitle
,$comboBoxDepartment
: GUI field objects$password
: Generated password for new user$groupNamesAdd
,$groupNamesRemove
: Groups to add/remove for baseline membership
#
Command Line Flags
None for standard use.
#
Outputs
- Creates new AD user accounts and home directories
- Copies group memberships from mirror user
- Enables Exchange Online mailbox
- Ensures correct group memberships
- Displays credentials in pop-up and copies password to clipboard
- Logs actions and errors to the console and pop-ups
#
Notes
- Requires the Active Directory and Exchange Online Management modules
- Uses an external password generator script (dot-sourced)
- GUI-based; not suitable for headless environments