GWS-016 · Script
Graduating Class Suspension and Archive
Suspends a graduating class and moves the accounts to an archive OU at year end.
Version 1.0.0Language PowerShellUpdated November 2026
What it does
Finds every user in the graduating class OU, skips anyone in an exclusion list (for example students returning for a fifth year), and for each remaining student:
- Moves the account to the archive OU (created if missing)
- Removes the account from all groups, if -RemoveFromGroups is set
- Removes a license, if -RemoveLicenseSku is set
- Suspends the account (default), or marks it Archived with -UseArchivedUserLicense
Nothing is deleted. A CSV list of the processed students is saved for your records. Tip: tell students to download their files with Google Takeout before you run this. Preview mode (default) shows every change without making it.
Requirements
GAM7, installed and authorized by you. GAM is not included. Windows PowerShell 5.1 or PowerShell 7.
How to run it
- Run from: an admin workstation or scheduled task with GAM7 set up
- This is an admin script for your Google Workspace tenant, not a per-device endpoint script
- User interaction: none with app-only sign-in
- Schedule: run on demand, or weekly for reports
Settings
| Name | What it does | Options | Default |
|---|---|---|---|
| Mode | Preview = show changes only (default). Apply = make the changes. | Preview, Apply | Preview |
| SourceOrgUnit | The graduating class OU, for example /Students/2026 | required | |
| ArchiveOrgUnit | Where accounts go, for example /Archive/Graduates/2026 | required | |
| ExcludeCsv | Optional CSV with an Email column of students to leave alone. | ||
| RemoveFromGroups | Remove each student from all groups. | False | |
| RemoveLicenseSku | Optional license SKU ID to remove. | ||
| UseArchivedUserLicense | Set accounts to Archived (requires Archived User licenses) instead of Suspended. | False | |
| GamPath | Path to GAM. Default: gam (on PATH). | gam |
Exit codes
- 0 = Completed, nothing needs attention
- 1 = Completed, but some steps failed
- 2 = Script error (see log)
Testing steps
- Run it first with the mode set to Preview on one test account or small group. Nothing is changed in that mode.
- Read the log and confirm the planned changes are what you expect.
- Run your chosen settings on the same test target and confirm the result.
- Check the exit code: 0 = OK, 1 = needs attention, 2 = error (see log), 9 = this copy is past its Valid until date.
- Roll out to a small group next, then everyone.
Rollback steps
Preview mode changes nothing. Restore accounts with GWS-002 and move them back to the class OU with GWS-001.
Version and change log
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | November 2026 | First release. |