User Query with Custom Schema

871 views
Skip to first unread message

Jeffrey Wickersty

unread,
Oct 18, 2021, 12:32:59 PM10/18/21
to GAM for Google Workspace
Hey folks,

I've been looking into this for a while and having trouble nailing down whether this possible or not, and if so, how.

I have a Custom Schema named "ActiveDirectory" and it contains two text fields named "Class" and "Status".

What I'm trying to do is write a GAM command to print users where the value of one of those fields is X. So for example:

gam print users query "ActiveDirectory.Status==ACTIVE"
or 
gam print users query "ActiveDirectory.Class==FT"

can't seem to nail down the syntax nor find anything involving custom schemas and queries in the GAMADV documentation.

Any ideas?

Thanks!

Jeffrey Wickersty

unread,
Oct 18, 2021, 12:34:00 PM10/18/21
to GAM for Google Workspace
Have also tried:

gam print users query "ActiveDirectory.Status='ACTIVE'" with single equals and single quotes around values, no luck.

Rance Hall

unread,
Oct 18, 2021, 12:42:08 PM10/18/21
to google-ap...@googlegroups.com

You need advanced GAM for this. 

 

Try: https://github.com/taers232c/GAMADV-XTD3/wiki/Schemas

 

But I’m curious why youd want to do an AD status field.  IT seems to me that you should be doing AD sync and if the status of the user isn’t enabled suspend the user in google.

 

Just my $0.02

 

R

 

-- 

 

Rance Hall

Application Specialist

ESU 10

308-698-1919

 


Some days are better, some days are worse.

Look for the blessing instead of the curse.

 

A picture containing text, sign, green

Description automatically generated

 

 

 

 

 

From: google-ap...@googlegroups.com <google-ap...@googlegroups.com> on behalf of Jeffrey Wickersty <je...@wickersty.com>
Date: Monday, October 18, 2021 at 11:33 AM
To: GAM for Google Workspace <google-ap...@googlegroups.com>
Subject: [GAM] User Query with Custom Schema

[EXTERNAL EMAIL]

--
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/c3ee08a7-9139-4c26-ba44-785fa966d228n%40googlegroups.com.

Jeffrey Wickersty

unread,
Oct 18, 2021, 1:01:50 PM10/18/21
to GAM for Google Workspace
I saw that Wiki page, but it just talks about managing schemas, not about querying users based on schema values.

And the meaning behind the examples given aren't what you're thinking - don't let the example names/values get in the way of the goal. For purposes of question, it could be ActiveDirectory.FavoriteColor='GREEN'

Jeff

Jeffrey Wickersty

unread,
Oct 18, 2021, 1:35:06 PM10/18/21
to GAM for Google Workspace
In case anyone is stuck with this in the future, here's the solution:

Custom Attributes must be indexed in order to query against them.

So first I ran this GAM command to set the custom attribute as indexed, then I could run the second GAM command to query for it:

1) gam update schema ActiveDirectory field Class indexed

2) gam print users query "ActiveDirectory.Class:'FT'"


Jay Lee

unread,
Oct 18, 2021, 1:56:41 PM10/18/21
to google-ap...@googlegroups.com

Jay Lee

unread,
Oct 18, 2021, 1:58:28 PM10/18/21
to google-ap...@googlegroups.com
Yep, indexing is always a good idea for any field you may wish to search on.

gam print schema

will show you this info.

Jay Lee


Rance Hall

unread,
Oct 18, 2021, 2:06:33 PM10/18/21
to google-ap...@googlegroups.com

Maj Marshall Giguere

unread,
Oct 18, 2021, 2:41:39 PM10/18/21
to google-ap...@googlegroups.com
Have you tried "customSchema.Activedirectory"
--
Maj Marshall E Giguere
NH Wing Director of IT
Nashua Composite Squadron IT Officer
Civil Air Patrol, U.S. Air Force Auxiliary




Volunteers serving America's communities, saving lives, and shaping futures.


--

Maj Marshall Giguere

unread,
Oct 18, 2021, 2:45:02 PM10/18/21
to google-ap...@googlegroups.com
Oops! Type "customSchemas.<attribute>"

--
Maj Marshall E Giguere
NH Wing Director of IT
Nashua Composite Squadron IT Officer
Civil Air Patrol, U.S. Air Force Auxiliary




Volunteers serving America's communities, saving lives, and shaping futures.

Reply all
Reply to author
Forward
0 new messages