Generate report of all users but exclude 1 OU

32 views
Skip to first unread message

Charles Allen

unread,
Mar 29, 2023, 3:10:52 PM3/29/23
to GAM for Google Workspace
Hello, I am trying to generate a report of users for all OU's and sub OU's except for 1. 

I attempted to do this by generating a list of all users

gam redirect csv ./nyosusers.csv print users

then I ran the following command

gam redirect csv ./nyosuserNoStudents.csv multiprocess csv ./nyosusers.csv gam user "~primaryEmail" print fields firstname,lastname,suspended,lastLoginTime,organizations

My thoughts were I could just manually remove the users from the excluded OU once I have that final report however it was not able to correctly generate the organizations column. 

How should I adjust these queries? 

I attached a screenshot of our OU structure as a photo attachment just in case.

I am trying to exclude users from the Student OU

 Capture.PNG

Ross Scroggs

unread,
Mar 29, 2023, 3:34:51 PM3/29/23
to google-ap...@googlegroups.com
Charles,

gam print users queries "orgUnitPath='/FACULTY&STAFF'","\"orgUnitPath='/School Board'\"","orgUnitPath='/Test'" fields firstname,lastname,suspended,lastLoginTime,organizations


This will work on Linux/Mac OS/Windows Command prompt.


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/a9f17e28-ab46-4013-8b55-604a464460a0n%40googlegroups.com.


--

Charles Allen

unread,
Mar 29, 2023, 3:47:31 PM3/29/23
to GAM for Google Workspace
Unfortunately it created the same empty contents in the organizations column. 

I would like it to show the OU's and sub OU's the user accounts are members of. 

Here is a screenshot of the results. 
Capture.PNG

Ross Scroggs

unread,
Mar 29, 2023, 3:52:09 PM3/29/23
to google-ap...@googlegroups.com
Charles,

Do you want their OU? That's different than orgainizations; replace organizations with orgunitpath.

Ross



--

Charles Allen

unread,
Mar 29, 2023, 4:06:56 PM3/29/23
to GAM for Google Workspace
That worked, thank you!
Reply all
Reply to author
Forward
0 new messages