GAM Query for active users in child OU

687 views
Skip to first unread message

Harpreet Simmons

unread,
May 16, 2022, 4:30:51 AM5/16/22
to GAM for Google Workspace
Hi There,

I need to be able to allocated Education Plus licenses to users from child OUs. I have been searching and found some really syntaxes that have assisted me in my mini project, but I am stuck at a query, having to both print only active users in the OU, and I am getting an error when I tried this: 

gam print users query "orgUnitPath='/Melbourne/Exxxx/StudentsU13'" isSuspended=false todrive
ERROR: isSuspended=false is not a valid argument for "gam print users"

Can I please get some assistance with my query above?

Thanking you in advance,
Harpreet 



IMPORTANT

The contents of this email and any attachments are confidential and may contain privileged information. Unauthorised use of the contents is expressly prohibited. Google Apps for Education, including Gmail stores information (including personal and sensitive information) in the “cloud” so the contents of this email and any attachments may be transferred to a country where Google provides the Google App services. CECV has made reasonable efforts to ensure information accessed by the Google App will be stored in a country where the privacy laws offer protection similar to that provided by the Australian Privacy Principles. The school’s privacy policy is available on the website.

If you have received this email in error, please notify the Catholic Education Commission of Victoria immediately by telephone on 03 9267 0422 (local call) or by email. 

James SEYMOUR

unread,
May 16, 2022, 4:38:59 AM5/16/22
to GAM for Google Workspace
Hi Harpreet,

You need to enclose the query statement in the ", so move it to the end of false.

gam print users query "orgUnitPath='/Melbourne/Exxxx/StudentsU13' isSuspended=false" todrive

Simmons, Harpreet

unread,
May 16, 2022, 8:31:35 PM5/16/22
to google-ap...@googlegroups.com

Hi James,

 

Thanks, that worked.

I do have another question and not sure if it is possible.

I have a couple of child OUs of StudentsU13, how do I run the query below to be able to extract the students from StudentsU13 as well as from the child OU?

 

Thanking you in advance,

Harpreet

 


Jerudong International School
https://www.jerudonginternationalschool.com

Follow us on:

http://www.facebook.com/jisbruneidarussalam http://www.twitter.com/jisbrunei http://www.instagram.com/jisbrunei https://www.youtube.com/user/JISBrunei https://www.flickr.com/photos/133960569@N03/albums

--
You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/3v5ocKGK8sg/unsubscribe.
To unsubscribe from this group and all its topics, 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/6994d214-e2a6-475e-9391-f4b726308409n%40googlegroups.com.





IMPORTANT! This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Melbourne Archdiocese Catholic Schools Ltd (MACS) does not represent or warrant that the attached files are free from computer viruses or other defects. The attached files are provided, and may only be used, on the basis that the user assumes all responsibility for any loss, damage or consequence resulting directly or indirectly from the use of the attached files, whether caused by the negligence of the sender or not. The liability of MACS is limited in any event to either the resupply of the attached files or the cost of having the attached files resupplied. Any representations or opinions expressed in this email are those of the individual sender, and not necessarily those of MACS.

James SEYMOUR

unread,
May 16, 2022, 9:02:48 PM5/16/22
to GAM for Google Workspace
Hi Harpreet,

By default the query orgUnitPath='/Top/OU' will search through the Child OUs as well. As a test I added fields primaryemail,name,ou to the command to check the OU of the selected users.

gam print users query "orgUnitPath='/Top/OU' isSuspended=false" fields primaryemail,name,ou todrive

Cheers

James

Ross Scroggs

unread,
May 16, 2022, 9:04:08 PM5/16/22
to google-ap...@googlegroups.com
Harpreet,

The query James gave should have included the child OUs.
Compare the output of these two commands.
Top OU and children
gam print users query "orgUnitPath='/Melbourne/Exxxx/StudentsU13' isSuspended=false" todrive
Top OU only
gam print users query limittoou "/Melbourne/Exxxx/StudentsU13" query "isSuspended=false" todrive

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/edac78f088c547a791ba4ad14f565e01%40macs.vic.edu.au.


--

Ross Scroggs

unread,
May 16, 2022, 9:04:49 PM5/16/22
to google-ap...@googlegroups.com
Harpreet,

What is: gam version

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/bbcb77e9-4b22-480c-a06d-e5788ce6c42dn%40googlegroups.com.


--

Ross Scroggs

unread,
May 16, 2022, 9:43:53 PM5/16/22
to google-ap...@googlegroups.com
Harpreet/James,

If you simply want a list of email addresses,you can do the following with Advanced GAM:
Top OU only, non-suspended users
gam ou_ns /Top/OU print users todrive

Top OU and sub OUs, non-suspended users
gam ou_and_children_ns /Top/OU print users todrive

You can replace _ns with _susp to see only the suspended users.

Remove the _ns to see non-suspended and suspended users.

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/bbcb77e9-4b22-480c-a06d-e5788ce6c42dn%40googlegroups.com.


--

Simmons, Harpreet

unread,
May 17, 2022, 7:48:47 PM5/17/22
to google-ap...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages