Adding Aliases in Bulk

4,448 views
Skip to first unread message

Karl Hehr

unread,
Jun 21, 2012, 12:53:02 PM6/21/12
to google-ap...@googlegroups.com
I am going to try and add aliases in bulk from a csv, but first I need the syntax to add an alias using GAM. I looked at the example syntax:

gam create alias idontwearseatbelts crashtestdummy

And it fails.

I tried:
gam update user crashtestdummy alias idontwearseatbelts

Also fails, each time it gives me the "help" screen telling me how I can use the gam commands and where to find more help.

I am using 2.5 on a 10.7 Mac in a Google Apps for education domain.

Moti Levy

unread,
Jun 21, 2012, 1:02:58 PM6/21/12
to google-ap...@googlegroups.com
your syntax is wrong.
try : 

gam create alias idontwearseatbelts user crashtestdummy

or 

gam update alias idontwearseatbelts user crashtestdummy 


--
You received this message because you are subscribed to the "Google Apps Manager" group.
To post to this group, send email to
google-ap...@googlegroups.com
To unsubscribe from this group, send email to
google-apps-man...@googlegroups.com
For more options, visit this group at
https://groups.google.com/forum/#!forum/google-apps-manager

Peter Roelant

unread,
Jun 21, 2012, 1:03:49 PM6/21/12
to google-ap...@googlegroups.com
Karl,

The command you're looking for is :

gam create alias idontwearseatbelts user crashtestdummy

which will make an alias idontwearseatbelts to user crashtestdummy

Kind Regards,

 

Peter



--

Jay Lee

unread,
Jun 21, 2012, 1:09:34 PM6/21/12
to google-ap...@googlegroups.com
Sorry Karl,

  The syntax was wrong in the Wiki examples. I've fixed it now. The correct documentation for creating aliases can also be found at:

Karl Hehr

unread,
Jun 22, 2012, 5:35:40 AM6/22/12
to google-ap...@googlegroups.com
Thanks. Works great. 

Sent from my iPhone

Karl Hehr

unread,
Jun 28, 2012, 3:19:04 PM6/28/12
to google-ap...@googlegroups.com
Now I am working on getting the bash script to work to read users from a csv file. Here is the syntax of my script:

#!/bin/bash

while read alias username
do

#This line adds an alias to the listed user
python gam.py create alias $alias user $username

done < /Users/karlhehr/Desktop/alias2.csv>


The csv file has "alias,username" and then repeats for all users.
Example:
khehr,karl.hehr
bdole,bob.dole
tfoolery,tom.foolery


--Karl

To unsubscribe from this group, send email to

For more options, visit this group at
https://groups.google.com/forum/#!forum/google-apps-manager

--
You received this message because you are subscribed to the "Google Apps Manager" group.
To post to this group, send email to

To unsubscribe from this group, send email to

For more options, visit this group at
https://groups.google.com/forum/#!forum/google-apps-manager

--
You received this message because you are subscribed to the "Google Apps Manager" group.
To post to this group, send email to

To unsubscribe from this group, send email to

Karl Hehr

unread,
Jun 28, 2012, 3:35:35 PM6/28/12
to google-ap...@googlegroups.com
That gives me a syntax error, I forgot to mention that in the earlier email.

Karl Hehr

unread,
Jun 29, 2012, 11:22:16 AM6/29/12
to google-ap...@googlegroups.com
Here is the finished and WORKING script:

#!/bin/bash

OLDIFS=$IFS
IFS=,

while read alias username
do

#This line adds an alias to the listed user
python gam.py create alias $alias user $username

done < /path to .csv

IFS=$OLDIFS

simon

unread,
Aug 14, 2012, 8:07:41 AM8/14/12
to google-ap...@googlegroups.com
you can also use PowerShell

$list = Import-Csv c:\gam\studentsaliases.csv
foreach ($entry in $list)
  {
    c:\gam\gam.exe create alias $($entry.alias) user $($entry.username)
  }

Jason Miller

unread,
Feb 25, 2014, 2:32:14 PM2/25/14
to google-ap...@googlegroups.com
Hey Karl - I am slowly making sense of how this works, but how would I actually execute this script?... type it into terminal? If you have a moment to reply I would greatly appreciate the help!!

Karl Hehr

unread,
Feb 25, 2014, 2:42:58 PM2/25/14
to google-ap...@googlegroups.com
The script is written in text edit or text wrangler and saved as a ".sh"
Then you execute the bash script in terminal.


--
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/af5adc83-40d5-4f96-b9f7-6d7b77ed06fb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Karl H. Hehr
Technology Director
Ames Community Schools
---------------------------
twitter: karlhehr
skype: karlhehr

Nino Iaccarino

unread,
Mar 8, 2015, 9:43:47 PM3/8/15
to google-ap...@googlegroups.com
Hi Simon,

Can you please provide an example of the .csv headers you used for this ?

Thanks!

Amar Thombare

unread,
Jan 28, 2017, 4:31:23 AM1/28/17
to GAM for G Suite, levy...@gmail.com
Hello,

Someone please share me the CSV file format and command to upload  user aliases in G suite. I am using GAM.


-Amar


On Thursday, June 21, 2012 at 10:32:58 PM UTC+5:30, Moti Levy wrote:
your syntax is wrong.
try : 

gam create alias idontwearseatbelts user crashtestdummy

or 

gam update alias idontwearseatbelts user crashtestdummy 


On Thu, Jun 21, 2012 at 12:53 PM, karl.hehr <karl...@gmail.com> wrote:
I am going to try and add aliases in bulk from a csv, but first I need the syntax to add an alias using GAM. I looked at the example syntax:

gam create alias idontwearseatbelts crashtestdummy

And it fails.

I tried:
gam update user crashtestdummy alias idontwearseatbelts

Also fails, each time it gives me the "help" screen telling me how I can use the gam commands and where to find more help.

I am using 2.5 on a 10.7 Mac in a Google Apps for education domain.

--
You received this message because you are subscribed to the "Google Apps Manager" group.
To post to this group, send email to
google-ap...@googlegroups.com
To unsubscribe from this group, send email to

Kevin Melillo

unread,
Jan 30, 2017, 8:44:01 AM1/30/17
to google-ap...@googlegroups.com, levy...@gmail.com
CSV File Format:

username,alias_to_add
username1,alias1
username2,alias2

GAM COMMAND
gam csv userlist.csv gam update user ~username alias ~alias_to_add

Please let me know if that resolves the issue.



For more options, visit this group at
https://groups.google.com/forum/#!forum/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-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/e53290c6-c8a4-41c2-b919-a1d01303907e%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

Todd Green

unread,
Aug 16, 2017, 11:06:41 AM8/16/17
to GAM for G Suite, j...@ditoweb.com
Hello, 

This link is outdated. Can you update? I am trying to create aliases and, as I am trained as teacher, I am in way over my head here. I did run GAM and tried to create a single alias. This is the error I received. 

ERROR: 403: Domain cannot use apis. - domainCannotUseApis


I am trying to create 500+ aliases and could really use some assistance. 


Thank you


For more options, visit this group at
https://groups.google.com/forum/#!forum/google-apps-manager

--
You received this message because you are subscribed to the "Google Apps Manager" group.
To post to this group, send email to
google-ap...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
https://groups.google.com/forum/#!forum/google-apps-manager





Haddon Township School District email is intended for professional communication. Messages sent via email may not be secure. Administrators may review communications to ensure the responsible use of the system. If you are not the intended recipient or authorized to receive this for the intended recipient, you must not use, copy, disclose or take any action based on this message or any information herein. Please notify the sender if you have received this in error, then delete the message. Haddon Township School District does not accept liability for any errors or viruses contained in this email. 

Graham Ingleby

unread,
Aug 16, 2017, 11:28:27 AM8/16/17
to GAM group
Hi Tod


You will also find the Bulk Operations section useful https://github.com/jay0lee/GAM/wiki/BulkOperations

However, I think your first port of call should be setting up GAM, for this make sure you have the latest version and follow the instructions at https://github.com/jay0lee/GAM/wiki

Graham


This message is for the named person's use only. If you receive this message in error, please delete it and notify the sender. Ancoris reserves the right to monitor all e-mail communications through its networks. Ancoris Limited, Registered in England Number: 04830784, Registered address: 5a Frascati Way, Maidenhead, Berkshire SL6 4UY. Trading Address: Lily Hill House, Lily Hill Road, Bracknell, Berkshire RG12 2SJ




Ross Scroggs

unread,
Aug 16, 2017, 4:54:35 PM8/16/17
to google-ap...@googlegroups.com
Kevin's example should be:
CSV File Format:

username,alias_to_add
username1,alias1
username2,alias2

GAM COMMAND
Corrected: gam csv userlist.csv gam create alias ~alias_to_add user ~username 

Ross



--
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.



--

✉ Kevin Melillo

unread,
Aug 17, 2017, 7:37:18 AM8/17/17
to google-ap...@googlegroups.com
Wow! Can't believe I missed that...  wait, yes I can!  Need more coffee...  Thank you Ross!

On Wed, Aug 16, 2017 at 4:54 PM, Ross Scroggs <ross.s...@gmail.com> wrote:
Kevin's example should be:
CSV File Format:

username,alias_to_add
username1,alias1
username2,alias2

GAM COMMAND
Corrected: gam csv userlist.csv gam create alias ~alias_to_add user ~username 

Ross

On Wed, Aug 16, 2017 at 8:28 AM, 'Graham Ingleby' via GAM for G Suite <google-apps-manager@googlegroups.com> wrote:
Hi Tod


You will also find the Bulk Operations section useful https://github.com/jay0lee/GAM/wiki/BulkOperations

However, I think your first port of call should be setting up GAM, for this make sure you have the latest version and follow the instructions at https://github.com/jay0lee/GAM/wiki

Graham


This message is for the named person's use only. If you receive this message in error, please delete it and notify the sender. Ancoris reserves the right to monitor all e-mail communications through its networks. Ancoris Limited, Registered in England Number: 04830784, Registered address: 5a Frascati Way, Maidenhead, Berkshire SL6 4UY. Trading Address: Lily Hill House, Lily Hill Road, Bracknell, Berkshire RG12 2SJ




--
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+unsubscribe...@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.



--

--
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.



--
Reply all
Reply to author
Forward
Message has been deleted
0 new messages