GWS-003 · Script
Group Membership Management
Adds or removes Google Group members from a CSV, or keeps a group in sync with an OU.
What it does
CSV mode: each row adds or removes one member with a role (Member, Manager, Owner). Missing groups can be created with -CreateMissingGroups. Rows that are already correct are skipped. Sync mode: makes a group's user members match the users in an OU (optionally including sub-OUs). Group members that are other groups are left alone. Preview mode (default) shows every change without making it; in sync mode it uses GAM's own preview so you see exactly who would be added and removed.
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 |
| InputCsv | CSV with columns: Group, Email, Action (Add or Remove), Role (optional: Member, Manager, Owner). | ||
| CreateMissingGroups | Create any group in the CSV that does not exist yet. | False | |
| SyncGroup | Group to keep in sync with -SyncOrgUnit. | ||
| SyncOrgUnit | OU whose active users should be the group's user members. | ||
| IncludeSubOrgUnits | Include users in sub-OUs of -SyncOrgUnit. | False | |
| GamPath | Path to GAM. Default: gam (on PATH). | gam |
Exit codes
- 0 = Completed, nothing needs attention
- 1 = Completed, but some rows 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. Run the same CSV with the opposite action (add or remove). In sync mode, members removed from the group must be added back from the log.
Version and change log
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | November 2026 | First release. |