Query Multiple OU's at one time?

591 views
Skip to first unread message

Andrew Moore

unread,
Jul 28, 2014, 5:48:26 PM7/28/14
to google-ap...@googlegroups.com
Is it possible to query Multiple OU at one time? I don't want to query them all, but I want to query multiple to export to a file. instead of run several different query then putting the file together, which I can do if needed.

Example: /usr/bin/python gam.py print users firstname lastname ou orderby email query 'isSuspended=false orgUnitPath=/Student '> GAMUSERLIST.csv

The query above works fine, but I want to do it against multiple OU's not just one, but not all either.

Jay Lee

unread,
Jul 29, 2014, 8:51:09 AM7/29/14
to google-ap...@googlegroups.com
The only way to do that with one command would be to have the two OUs underneath a common parent OU. orgUnitPath= returns all users in the given OU and sub-OUs. So if you had:

/Student
  K-6
  Middle School
  HIgh School

with students in each of K-6, Middle School and High School then your query will return all of them.



Jay Lee


--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/c848367e-c47b-416b-9376-1f685c06f5c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Moore

unread,
Jul 31, 2014, 10:19:21 AM7/31/14
to google-ap...@googlegroups.com
Thanks Jay,

That is what I was guessing, just wanted to confirm


On Tuesday, July 29, 2014 6:51:09 AM UTC-6, Jay Lee wrote:
The only way to do that with one command would be to have the two OUs underneath a common parent OU. orgUnitPath= returns all users in the given OU and sub-OUs. So if you had:

/Student
  K-6
  Middle School
  HIgh School

with students in each of K-6, Middle School and High School then your query will return all of them.



Jay Lee


On Mon, Jul 28, 2014 at 5:48 PM, Andrew Moore <andrew...@aims.edu> wrote:
Is it possible to query Multiple OU at one time? I don't want to query them all, but I want to query multiple to export to a file. instead of run several different query then putting the file together, which I can do if needed.

Example: /usr/bin/python gam.py print users firstname lastname ou orderby email query 'isSuspended=false orgUnitPath=/Student '> GAMUSERLIST.csv

The query above works fine, but I want to do it against multiple OU's not just one, but not all either.

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.

Mehboob Alam

unread,
Aug 2, 2014, 6:20:16 PM8/2/14
to google-ap...@googlegroups.com
I'm getting this error, can you any shed light on what I'm missing? GAM/Windows

C:\gam>gam print users firstname lastname ou query 'orgUnitPath=/student '> GAMUSERLIST.csv
Traceback (most recent call last):
  File "gam.py", line 7172, in <module>
  File "gam.py", line 5513, in doPrintUsers
NameError: global name 'exit' is not defined

If I omit the the query part, it seems to work.. thanks.

+KimNilsson

unread,
Aug 9, 2016, 2:41:47 PM8/9/16
to Google Apps Manager
Yeah, just realised I didn't know how to make query only fetch users from the OU specified and not the sub-OUs.
Reply all
Reply to author
Forward
0 new messages