getting a full list of users in a domain with a first name of sally

779 views
Skip to first unread message

Rick Humphrey

unread,
Sep 24, 2018, 2:18:35 PM9/24/18
to GAM for G Suite
Currently using Gam and not advance gam
 
I have been trying to get a full list of names in an ORg and sub orges that have a first name of Sally

I would like it to export to a csv and give the following information

First name
Last name
Email address

If I do this
gam print users query "orgUnitPath="/Org1/suborg1" givenName="Sally"" >Sallyusers.csv 

Two problems with above approach

1. It only pulls the users from suborg1 - I would like to get a full list of all  Sally's in ORg 1 and in all sub orgs . I can't figure out the command using ou_and_children  in it
2 It only shows me email addresses in csv  ( I could to text to column to break it apart )

Thanks
as always your help is appreciated





Jay Lee

unread,
Sep 24, 2018, 2:24:34 PM9/24/18
to google-ap...@googlegroups.com
Try:

gam print users query givenName=Sally firstname lastname ou > Sallyusers.csv

you'll need to locally filter out users whose OrgUnit is not /Org1/suborg1 or sub-OU thereof with grep or similar.

Jay

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" 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 https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/c8df78d1-d065-4bcf-baf7-b92e30cf2893%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ross Scroggs

unread,
Sep 24, 2018, 2:33:41 PM9/24/18
to google-ap...@googlegroups.com
Rick,

From the documentation:
The full path of an org unit. This matches all org unit chains under the target. For example, 'orgUnitPath=/' returns all users in the organization.
So, don't specify a sub OU if you want everything under /Org

gam print users query "orgUnitPath='/Org1' givenName='Sally'" name ou >Sallyusers.csv 

That's double quotes around the whole query, single quotes inside

Ross


For more options, visit https://groups.google.com/d/optout.


--

Rick Humphrey

unread,
Oct 11, 2018, 2:47:15 PM10/11/18
to GAM for G Suite
Thanks for this Ross

Using what you had I tried to break this down to familyName that contains Smit 

gam print users query "orgUnitPath='/Org1' givenName='Sally'" name ou >Sallyusers.csv 
so I changed it to

gam print users query "orgUnitPath='/Org1' familyName=''*smit*" name ou >containsmit.csv 

I was trying to get all my users that have smit somewhere in their family name. That's the reason for the * in front and behind smit

Can * be used?

Thanks
Rick
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.

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


--

Ross Scroggs

unread,
Oct 11, 2018, 3:06:09 PM10/11/18
to google-ap...@googlegroups.com
Rick,

Read notes under operators.

You can try this but I don't think it's exactly what you want as it will only find Smit as a stand-alone word.
gam print users query "orgUnitPath='/Org1' familyName:Smit" name ou >containsmit.csv

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 https://groups.google.com/group/google-apps-manager.

Rance Hall

unread,
Oct 11, 2018, 3:25:33 PM10/11/18
to google-ap...@googlegroups.com

Rick,

 

I was just looking at this documentation for something I’m working on as this thread started.

 

The docs say that there is very limited support for wildcards.

 

Going from Ross’ sample gam command I should be able to do this:

 

gam print users query "orgUnitPath='/Org1' familyName:Smit*" name ou >containsmit.csv

 

What you want is more complicated than this.  You really want this: (if I read your question right)

 

gam print users query "orgUnitPath='/Org1' familyName:*[S/s]mit*" name ou >containsmit.csv

 

You want wildcards at both ends and you need a case insensitive search.  GamADV/Google may or may not be doing the case insensitive search for you and there is no documentation that says that wildcards work anywhere but the end of the string.

 

So this may not even be possible due to API limitations.  If so, you’ll likely have to fall back to requesting all users from the orgunit and parsing the list with other tools.

 

Rance

-- 

Rance Hall

ESU 10 Application Specialist

O: 308-698-1919

F: 308-233-9066

Ross

 

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 https://groups.google.com/group/google-apps-manager.

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" 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 https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CA%2BVVBp-r%2BtXiKxoAk0hBjBFMk5Mc%2Bdy%2BCc1Qzjs3LWvZsi14AQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


 

--

Ross Scroggs

 

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" 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 https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/54134daf-a701-4d35-ba0e-0654db12d356%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" 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 https://groups.google.com/group/google-apps-manager.

Rick Humphrey

unread,
Oct 11, 2018, 3:27:32 PM10/11/18
to google-ap...@googlegroups.com
Thanks Ross
I was hoping for any name in my domain that contains smit but exclusive to smit. in the last name.


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 https://groups.google.com/group/google-apps-manager.

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" 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 https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CA%2BVVBp-r%2BtXiKxoAk0hBjBFMk5Mc%2Bdy%2BCc1Qzjs3LWvZsi14AQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" 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 https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/54134daf-a701-4d35-ba0e-0654db12d356%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" 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 https://groups.google.com/group/google-apps-manager.

For more options, visit https://groups.google.com/d/optout.


--

Rick Humphrey
Wolf Creek Public Schools
Technology Services
Reply all
Reply to author
Forward
0 new messages