Update README to reflect [username]@domain format

This commit is contained in:
2026-05-15 10:59:22 +10:00
parent 3d231b757f
commit 8d1c21116d
+5 -7
View File
@@ -1,19 +1,18 @@
# Set-StudentEmail
PowerShell script to bulk-assign email addresses to Active Directory student users based on their first name and surname.
PowerShell script to bulk-assign email addresses to Active Directory student users based on their AD username (SamAccountName).
## How It Works
The script scans all user accounts in a specified Organisational Unit (OU) and sets each user's email address to:
```
[firstname][surname]@[domain]
[username]@[domain]
```
For example, a student named **Jane Smith** would be assigned `janesmith@niddrieautisticschool.vic.edu.au`.
For example, a student with the AD username **jsmith** would be assigned `jsmith@niddrieautisticschool.vic.edu.au`.
- Emails are forced to **lowercase** and any leading/trailing spaces in names are stripped.
- Users missing a `GivenName` or `Surname` in AD are skipped with a warning.
- Emails are forced to **lowercase** and any leading/trailing spaces in the username are stripped.
## Requirements
@@ -103,7 +102,7 @@ The script prints colour-coded status lines as it processes each user:
|--------|--------|---------|
| `SET:` | Green | Email was successfully applied |
| `OK:` | Grey | User already has the correct email (skipped) |
| `SKIP:` | Yellow | User skipped (missing name or has a different email without `-Force`) |
| `SKIP:` | Yellow | User skipped (has a different email without `-Force`) |
| `FAIL:` | Red | An error occurred updating the user |
A summary is printed at the end:
@@ -122,4 +121,3 @@ Errors: 0
| `Get-ADUser : Unable to find a default server` | Run from a domain-joined machine, or specify `-Server` manually in the script |
| `Access is denied` | Run as an account with write permissions to user objects in the target OU |
| `Module 'ActiveDirectory' not found` | Install RSAT: `Add-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0` |
| Users are skipped unexpectedly | Check that `GivenName` and `Surname` are populated in AD for those accounts |