GWS-005 · Script
Device Deprovisioning and Wipe Control
Deprovisions, disables, re-enables, or wipes managed devices by serial number from a CSV.
What it does
ChromeOS actions: Deprovision (retire), Disable, Reenable, WipeUsers (removes user profiles), Powerwash (factory reset; the device must then be re-enrolled). Phones, tablets and computers in endpoint management: Wipe and CancelWipe. Destructive actions (Deprovision, WipeUsers, Powerwash, Wipe) only run when you add -ConfirmDestructive as well as -Mode Apply. 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 |
| InputCsv | CSV with columns: SerialNumber, Action (Deprovision, Disable, Reenable, WipeUsers, Powerwash, Wipe, CancelWipe). | required | |
| DeprovisionReason | retiring (default), same_model_replace, different_model_replace, or upgrade_transfer. | retiring, same_model_replace, different_model_replace, upgrade_transfer | retiring |
| ConfirmDestructive | Required for Deprovision, WipeUsers, Powerwash and Wipe to run. | False | |
| GamPath | Path to GAM. Default: gam (on PATH). | gam |
Exit codes
- 0 = Completed, nothing needs attention
- 1 = Completed, but some rows failed or were blocked
- 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. Disabled devices can be re-enabled with the reenable action. Deprovisioning and wipes cannot be undone; the device must be enrolled again.
Version and change log
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | November 2026 | First release. |