Suspend multiple users with CSV query parameters?

43 views
Skip to first unread message

Matthew Shirley

unread,
Sep 3, 2025, 6:23:59 PM (2 days ago) Sep 3
to GAM for Google Workspace
I've received a list (csv) of first names and last names of users to suspend. I'd like to query from the csv and output primaryEmail or just suspend them all in one command but I'm sure I've got some syntax incorrect. I've tried many formats of commands but guess I need to know if it's possible first. My query should perform an AND so that I can at least output the user emails to a csv that I can then suspend. Here's a couple I've tried:

gam csv "*path*\GAM-Input.csv" gam print user query "firstname='~FIRST',lastname='~LAST'" primaryEmail > "*path*\GAM-Output.csv"

gam redirect csv "*path*\GAM-Output.csv" multiprocess csv "*path*\GAM-Input.csv" gam print user query “firstname='~FIRST', lastname='~LAST'” primaryEmail

I've attempted using ":" instead of "=", a space btween query tems and "AND". All return an "Query Invalid"

Any insight is aprreciated!

Ross Scroggs

unread,
Sep 3, 2025, 6:30:00 PM (2 days ago) Sep 3
to google-ap...@googlegroups.com

gam redirect csv "*path*\GAM-Output.csv" multiprocess  redirect stderr - multiprocess csv "*path*\GAM-Input.csv" gam print users query "givenName='~FIRST' familyName='~LAST'" fields primaryEmail 

Ross
----
Ross Scroggs



--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/c1daf485-c1d6-4193-b1ab-e4196a333940n%40googlegroups.com.

Matthew Shirley

unread,
Sep 3, 2025, 6:45:59 PM (2 days ago) Sep 3
to GAM for Google Workspace
I tried that command and it is outputting a csv with just a header "primaryEmail"

Ross Scroggs

unread,
Sep 3, 2025, 7:41:48 PM (2 days ago) Sep 3
to google-ap...@googlegroups.com
That means that npne of the quiries re matching, send me  private Meet/Zoom invitation and we'll investigate

Ross
----
Ross Scroggs


Ross Scroggs

unread,
Sep 3, 2025, 7:44:20 PM (2 days ago) Sep 3
to google-ap...@googlegroups.com

Did your commands outout like this?


$ gam print users query "givenName='Test' familyName='Simple'" fields primaryemail

Getting all Users that match query (query="givenName='Test' familyName='Simple'"), may take some time on a large Google Workspace Account...

Got 1 User: tests...@domain.com - tests...@domain.com

primaryEmail

tests...@domain.com


Ross


----
Ross Scroggs


Ross Scroggs

unread,
Sep 3, 2025, 8:21:05 PM (2 days ago) Sep 3
to google-ap...@googlegroups.com
Brain now fully enagged;you need ~~ at both ends of the column name.

gam redirect csv "*path*\GAM-Output.csv" multiprocess  redirect stderr - multiprocess csv "*path*\GAM-Input.csv" gam print users query "givenName='~~FIRST~~' familyName='~~LAST~~" fields primaryEmail 

Ross

----
Ross Scroggs



Matthew Shirley

unread,
Sep 4, 2025, 4:34:31 PM (yesterday) Sep 4
to GAM for Google Workspace
That ended up actually placing the names from the csv into the process, then I found the missing " ' " and it finally worked! I ended up running through my list manually last night, but now I can do a sweep through all my user lists. This is going to help a lot moving forward! It was driving me crazy, so thanks a bunch!
Reply all
Reply to author
Forward
0 new messages