# 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

# Function

  1. Loads required modules (Active Directory, Exchange Online Management).
  2. Presents a Windows Forms GUI for user input (first name, last name, employee ID, manager, mirror user, job title, department).
  3. Validates all fields before allowing user creation.
  4. Generates a random password using an external password generator script.
  5. Creates the AD user with all required attributes and home directory.
  6. Copies group memberships from a specified mirror user.
  7. Enables an Exchange Online mailbox for the new user.
  8. Ensures membership in required base groups and removes from non-standard signature groups.
  9. Displays the new credentials in a pop-up and copies the password to clipboard.
  10. 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