GWS-008 · Script
Mailbox Setup and Delegation
Manages Gmail delegated access from a CSV and applies a standard email signature to users.
What it does
Delegation: each row grants or removes one person's delegated access to a mailbox. Both accounts are checked first (they must exist and be active); rows already in the requested state are skipped. Signatures: fills an HTML template with each user's directory details and sets it as their Gmail signature. Supported tags in the template: {FirstName} {LastName} {FullName} {Email} {Title} {Department} {Phone} Missing values are replaced with nothing, so no raw tags appear in signatures. 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 |
| DelegationCsv | CSV with columns: Mailbox, Delegate, Action (Add or Remove). | ||
| SignatureTemplate | Path to an HTML signature template. | ||
| SignatureOrgUnit | Apply the signature to active users in this OU (and its sub-OUs). | ||
| SignatureUsersCsv | Or apply the signature to users listed in a CSV with an Email column. | ||
| GamPath | Path to GAM. Default: gam (on PATH). | gam |
Exit codes
- 0 = Completed, nothing needs attention
- 1 = Completed, but some rows failed or were skipped
- 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. Remove a delegate with the remove action. To restore an old signature, save it first and apply it again.
Version and change log
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | November 2026 | First release. |