Using "GAM info user" in Powershell

2,042 views
Skip to first unread message

Skylar Ragan

unread,
May 8, 2017, 6:38:12 PM5/8/17
to GAM for G Suite
I'm having a difficult time figuring out how to parse the data from 
GAM info user example@domain.com
in a way that Powershell understands.

Specifically, I want to get the email address for a user's manager as listed in Google and write it to a variable so that I can use it in other functions later in the script. Any help or suggestions are appreciated.

✉ Kevin Melillo

unread,
May 9, 2017, 8:22:08 AM5/9/17
to google-ap...@googlegroups.com
gam print users user <email address> > output.csv

Then you can use that csv file in your batch script to pull out the information needed.  You could probably do some piping as well...

--
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.
To post to this group, send email to google-apps-manager@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/ae091931-d3a7-4b8b-ad29-78d5baa3647d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Kevin Melillo
Electronic Communications Analyst
Information Technology
445 Hoes Lane
Piscataway, NJ 08854

Phone:732-465-6609 | Mobile: 732-609-4331

Skylar Ragan

unread,
May 9, 2017, 9:36:05 AM5/9/17
to GAM for G Suite
Your suggested command results in "ERROR: user is not a valid argument for "gam print users""

✉ Kevin Melillo

unread,
May 9, 2017, 9:41:08 AM5/9/17
to google-ap...@googlegroups.com
Whoops.  I am sorry..  I did not finish my coffee yet.

gam report users user <email address> > output.csv


On Tue, May 9, 2017 at 9:36 AM, Skylar Ragan <skylar...@smartsheet.com> wrote:
Your suggested command results in "ERROR: user is not a valid argument for "gam print users""

--
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.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

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

Jay Lee

unread,
May 9, 2017, 9:41:24 AM5/9/17
to google-ap...@googlegroups.com
Try:

gam print users query "email:us...@domain.com"

Jay

On May 9, 2017 9:36 AM, "Skylar Ragan" <skylar...@smartsheet.com> wrote:
Your suggested command results in "ERROR: user is not a valid argument for "gam print users""

--
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.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

Skylar Ragan

unread,
May 9, 2017, 10:19:49 AM5/9/17
to GAM for G Suite
Kevin: Unfortunately the output of that command doesn't include the Relations/Manager email address that I'm trying to get.

Jay: When I run that it just returns the primary email address associated with the email I specified (which was already the primary address, so I just got back the same email that I queried).

Jay Lee

unread,
May 9, 2017, 10:31:43 AM5/9/17
to google-ap...@googlegroups.com
That exercise was left to the reader :-) Add "relations" to the command to also return user relations (which manager should be one of.

On Tue, May 9, 2017 at 10:19 AM, Skylar Ragan <skylar...@smartsheet.com> wrote:
Kevin: Unfortunately the output of that command doesn't include the Relations/Manager email address that I'm trying to get.

Jay: When I run that it just returns the primary email address associated with the email I specified (which was already the primary address, so I just got back the same email that I queried).

--
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.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
Reply all
Reply to author
Forward
0 new messages