How to find users suspended for more than 90 days with GAM

GAM7 can select suspended accounts by how long ago they were disabled. Here is the 90-day command, how its options fit together, and the one combination that quietly includes archived accounts too.

"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:

Sources

  • GAM wiki: Users — GAM7 documentation. print users with issuspended, isarchived, isdisabled, disabledafter and disabledbefore, and the examples quoted above.

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.