Removing licenses from suspended users in an OU

859 views
Skip to first unread message

M Anon

unread,
Aug 7, 2022, 10:56:34 PM8/7/22
to GAM for Google Workspace
Hello all,

I am trying to remove all licenses from suspended users in an OU. The command from this site produces an error that initially indicates there is no ~primaryEmail header. When I tried to troubleshoot by removing the part after the pipe and just executing this:

gam print users query "orgUnitPath='/Path/To/User OU' isSuspended=true"

I find that the query is actually not being accepted.

Does anyone know what the correct query should be?

Also, along that same line of inquiry, I'd also like to add a license SKU to anyone in that OU who does not have the license but is active. Assuming the query problem is fixed, can I jiust replace DELETE with ADD and change IsSuspended=false or is there a different command for it?

Appreciate if anyone can point me in the right direction.

M

Ross Scroggs

unread,
Aug 7, 2022, 11:02:06 PM8/7/22
to google-ap...@googlegroups.com
The query works for me:
$ gam print users query "orgUnitPath='/Test' isSuspended=true"
Getting all Users that match query (orgUnitPath='/Test' isSuspended=true), may take some time on a large Google Workspace Account...
primaryEmail

Show your query and any error message.

Ross

--
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 on the web visit https://groups.google.com/d/msgid/google-apps-manager/d4b8a893-bddb-414b-a72a-7cfd30a96a7bn%40googlegroups.com.

M Anon

unread,
Aug 8, 2022, 12:39:57 AM8/8/22
to GAM for Google Workspace
Apologies for wasting your time Ross. It was a mistake on my part: I should've used /Students instead of /School Name/Students.
Reply all
Reply to author
Forward
0 new messages