"How many accounts have been suspended for more than three months?" is the question that starts every cleanup, and until recently it meant exporting everything and working it out by hand. GAM7 can now answer it directly.
The short answer
gam print users issuspended disabledbefore -90d
That is one of the examples in GAM's own documentation. To send the list to a Google Sheet:
gam print users issuspended disabledbefore -90d todrive
The -90d means 90 days ago. Change the number to change the cut-off.
What the 90 days is measured from. The output carries disabledTime and suspensionTime columns, and the cut-off is applied to those: the account's own suspension timestamp, not a general last-modified date. The filter measures what you would expect it to measure.
How the options fit together
The GAM documentation explains that "The isarchived, issuspended and isdisabled options can be used to select users based on their archival/suspension status." (GAM wiki: Users) The one to watch is isdisabled, which the documentation defines as "Archived or Suspended Users".
Leave issuspended out and you get archived accounts too. The documentation is exact about it: "When none of isarchived, issuspended, isdisabled are specified, but one or both of disabledafter or disabledbefore is specified, then isdisabled true is selected." So disabledbefore -90d on its own lists every account disabled more than 90 days ago, archived ones included. If the next step is archiving, that list has accounts in it you have already dealt with. Keep issuspended in the command.
For a window rather than a cut-off, give both dates. The documentation's own example lists accounts disabled between 60 and 30 days ago:
gam print users isdisabled disabledafter -60d disabledbefore -30d
What to do with the list
Every account on it is still holding a license; how to list suspended users with GAM explains why. For most of them there are three choices:
- Archive the ones you are finished with. In an Education domain that frees the license and keeps the data under Vault retention. See how to archive suspended users with GAM.
- Transfer and delete the ones whose files are needed elsewhere, in that order. See how to transfer Google Drive ownership with GAM.
- Keep the ones that are suspended on purpose, and write down why, so next year's list is shorter.
Sources
- GAM wiki: Users — GAM7 documentation.
print userswithissuspended,isarchived,isdisabled,disabledafteranddisabledbefore, and the examples quoted above.
Related guides
- How to list suspended users with GAM
- How to archive suspended users with GAM
- How to transfer Google Drive ownership with GAM
In ORINEX Workspace, the Users page filters to suspended accounts in one click, so the accounts this command finds are already in front of you when you decide what happens to each. What ORINEX Workspace does.