docs: add session log for student email assignment script

This commit is contained in:
jessikitty committed 2026-09-24 00:12:30 +10:00
1 parent 8d1c21116d
commit b826aa6cc5
1 file changed
+34
@@ -0,0 +1,34 @@
# Bulk Student Email Assignment Script
**Date:** 2026-05-15
**Project:** Set-StudentEmail
**Status:** resolved
**Tags:** powershell, active-directory, email, students, bulk-update
## Context
Student accounts in AD needed their `mail` attribute populated consistently so downstream systems had a reliable address per student. Jess wanted a script that walks the student OU and assigns every account an address derived from its AD username, with a safe preview mode.
## Key Decisions
- **`[SamAccountName]@<domain>` format** — the first version built addresses from firstname + surname, but this was switched the same day to the username. Username-based addresses are guaranteed unique and don't break on duplicate names, hyphenated/multi-part surnames, or name changes.
- **Lowercase and trimmed** — avoids case-mismatch and stray whitespace from imported usernames.
- **Don't overwrite by default** — existing addresses are left alone unless `-Force` is passed, so manually-corrected addresses aren't clobbered.
- **`-WhatIf` as the recommended first run** — preview before touching AD.
- **OU and domain as parameters with defaults** — defaults suit the school, but the script can be pointed elsewhere.
## Technical Details
- Script: `Set-StudentEmail.ps1`
- Parameters: `-OU` (DN of student OU; default `<redacted>`), `-Domain` (default `<redacted>`), `-Force`, `-WhatIf`.
- Requires the ActiveDirectory module and rights to modify user attributes in the target OU; run from a domain-joined machine or via `Enter-PSSession` to a DC.
## Code Changes
- `Set-StudentEmail.ps1` — new; OU scan, address build, skip/overwrite logic, WhatIf support. Later changed from name-based to username-based addresses.
- `README.md` — full usage docs and examples; updated for `[username]@domain` format.
## Open Questions / Next Steps
- Not scheduled — currently run manually. Could be folded into the enrolment/AD sync workflow so new students get addresses automatically.
- No log file output; consider writing a change log like `Staff-AD-email-disabler` does if it becomes a scheduled task.
## Artifacts
- `3d231b7` — Change email format to [username]@domain
- `420a964` — Add Set-StudentEmail script
- Repo: https://gitea.hideawaygaming.com.au/jessikitty/Set-StudentEmail