need help: GAM Create User with attributes

2,130 views
Skip to first unread message

Sebastian Brockmann

unread,
Oct 6, 2015, 6:54:10 AM10/6/15
to Google Apps Manager

Hello there.
my company is using GAM to create Gmail accounts and i encounter the following problem in the console.

D:\GAM 3.5>gam create user testuser
Creating account for test...@1worldsync.com

D:\GAM 3.5>firstname "Test"
'firstname' is not recognized as an internal or external command,
operable program or batch file.

D:\GAM 3.5>lastname "User"
'lastname' is not recognized as an internal or external command,
operable program or batch file.

D:\GAM 3.5>organization name 1WorldSync GmbH costcenter 9123
'organization' is not recognized as an internal or external command,
operable program or batch file.

D:\GAM 3.5>phonetype work value +42 221 32473 0 primary
'phonetype' is not recognized as an internal or external command,
operable program or batch file.

D:\GAM 3.5>address type work Streetaddress Maarweg 165 postalcode 50825 locality
User countrycode Germany
'address' is not recognized as an internal or external command,
operable program or batch file.

D:\GAM 3.5>gal off
'gal' is not recognized as an internal or external command,
operable program or batch file.

D:\GAM 3.5>password '1234gdgdb'
'password' is not recognized as an internal or external command,
operable program or batch file.

D:\GAM 3.5>changepassword off
'changepassword' is not recognized as an internal or external command,
operable program or batch file.

D:\GAM 3.5>phonetype mobile value +49 231 93653 157 not primary
'phonetype' is not recognized as an internal or external command,
operable program or batch file.

D:\GAM 3.5>gam update group ab...@1worldsync.com add user user testuse
r...@1worldsync.com
adding member user@1worldsync.com...added us...@1worldsync.com to group

D:\GAM 3.5>

the first & last command line works, everything else has a error inside because the programm doesnt understand the commands. any idea why this doesnt work? i followed the guideline on the main project

thanks for feedback in advance

Sebastian

Jay Lee

unread,
Oct 6, 2015, 7:06:41 AM10/6/15
to Google Apps Manager
All but adding the user to a group should be one long command:

gam create user testuser firstname "Test" lastname "User" organization name "1WorldSync GmbH" costcenter 9123 primary phone type work value "+42 221 32473 0" primary address type work Streetaddress "Maarweg 165" postalcode 50825 locality User countrycode Germany primary gal off password '1234gdgdb' changepassword off phone type mobile value "+49 231 93653 157" notprimary

notice also that I added quotes around any values that had spaces like phone numbers or street addresses and address, phone and organization all need to end with primary or notprimary.

Jay

--
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/82a9c851-e347-4eb4-aa69-aa6b797ebbb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Jay Lee

Sebastian Brockmann

unread,
Oct 6, 2015, 7:54:28 AM10/6/15
to Google Apps Manager
hey thanks for the reply,
when i try it with some test fragment it says the commands are not known as posted below 

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.

C:\Users\sbrockmann>cd \gam-64

C:\gam-64>gam update user sebastiantesto
updating user sebasti...@1worldsync.com...

C:\gam-64>firstname test
Der Befehl "firstname" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

C:\gam-64>streetaddress 123
Der Befehl "streetaddress" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

C:\gam-64>gam update user sebastiantesto streetaddress 123
Error: streetaddress is not a valid user update argument or custom schema name

C:\gam-64>gam update user sebastiantesto streetaddress "123"
Error: streetaddress is not a valid user update argument or custom schema name

C:\gam-64>gam update user sebastiantesto postalcode 123
Error: postalcode is not a valid user update argument or custom schema name

C:\gam-64>

Jay Lee

unread,
Oct 6, 2015, 8:25:04 AM10/6/15
to Google Apps Manager
Hi Sebastian,

  See my first response. You can't run these as fragments, it needs to be one long line.

  It sounds like you may need to familiarize yourself with some of the basics of using a command line before learning GAM. Try running through this tutorial:


Jay

D:\GAM 3.5>

the first & last command line works, everything else has a error inside because the programm doesnt understand the commands. any idea why this doesnt work? i followed the guideline on the main project

thanks for feedback in advance

Sebastian

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

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

Jay Lee

Sebastian Brockmann

unread,
Oct 7, 2015, 4:26:14 AM10/7/15
to Google Apps Manager
Hey,
when i enter the code line together i get a error message:
 this means i have a syntax error inside of the code line but i followed the exact commands in the documentation

D:\GAM 3.5>gam create user testuser firstname "Test" lastname "User" organizatio
n name "1Sync GmbH " costcenter 9123 primary phone type work value "+42 225
32333 36" primary address type work Streetaddress "aarweg 160" postalcode 50225
locality User countrycode Germany primary gal off password '1234gdgdb' changepas
sword off phone type mobile value "+49 235 93753 101" notprimary
Creating account for test...@1worldsync.com
Error 400: Invalid Input: Bad request for  - invalid



On Tuesday, October 6, 2015 at 12:54:10 PM UTC+2, Sebastian Brockmann wrote:

Ross Scroggs

unread,
Oct 7, 2015, 9:15:38 AM10/7/15
to google-ap...@googlegroups.com
Sebastian,

It should be ... countrycode DE ...

Countrycode values are not plain text, they come from a table: https://www.iso.org/obp/ui/#search/code/

Ross

D:\GAM 3.5>

the first & last command line works, everything else has a error inside because the programm doesnt understand the commands. any idea why this doesnt work? i followed the guideline on the main project

thanks for feedback in advance

Sebastian

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

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



--

Andrew Penner

unread,
Oct 5, 2017, 5:32:22 PM10/5/17
to GAM for G Suite
Hi Jay:

How would this command work with a .csv file where the fields include spaces?

For example, if the Address field in the .csv file is "123 Broad Avenue, New City, AB" (but no actual quotes in the .csv file), how do I update my code to handle spaces in a variable's value?

The code I'm using is:

gam.exe create user $($entry.Email) address type work Streetaddress $($entry.Address) primary



Ross Scroggs

unread,
Oct 5, 2017, 6:19:58 PM10/5/17
to google-ap...@googlegroups.com
Andrew,

You shouldn't have to deal with it, PowerShell should put the text in a single argument and Gam picks it up. Gam is not parsing the actual text. Test, it should be fine.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/1f207f50-9aab-46ce-a9d7-76d9c77a56f4%40googlegroups.com.

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



--

Andrew Penner

unread,
Oct 6, 2017, 10:37:00 AM10/6/17
to GAM for G Suite
Hi Ross, thanks for getting back to me.

Based on what I'd read elsewhere I thought that's how it would work, but the address information isn't being added to the user; the command works for Organizational information (Department, two words, Company, 4 words), but not the address.

It's not vital, as I can use another directory sync app, but I'd prefer to use Powershell and GAM to get this done.

If anyone's interested, here's the entirety of the command I'm using:
$list = Import-Csv c:\!User_Accounts\New_Staff.csv
foreach ($entry in $list)
    {
      c:\gam_spschools\gam.exe create user $($entry.Email) firstname $($entry.Firstname) lastname $($entry.Lastname) password $($entry.Password) org $($entry.Path) organization name $($entry.Company) title $($entry.Title) department $($entry.Department) primary address type work Streetaddress $($entry.Address) primary phone type work value $($entry.Telephone) primary phone type work fax value $($entry.Fax) notprimary
    }

Ross Scroggs

unread,
Oct 6, 2017, 12:24:36 PM10/6/17
to google-ap...@googlegroups.com
Andrew,

If you do a: gam info user some...@domain.com
What does the address field show?

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.



--

Ross Scroggs

unread,
Oct 6, 2017, 12:58:11 PM10/6/17
to google-ap...@googlegroups.com
Andrew,

You may also want to try: gam.exe create user $($entry.Email) address type work unstructured $($entry.Address) primary

Ross

On Fri, Oct 6, 2017 at 9:24 AM, Ross Scroggs <ross.s...@gmail.com> wrote:
Andrew,

If you do a: gam info user some...@domain.com
What does the address field show?

Ross
On Fri, Oct 6, 2017 at 7:37 AM, Andrew Penner <andrew...@5565.ca> wrote:
Hi Ross, thanks for getting back to me.

Based on what I'd read elsewhere I thought that's how it would work, but the address information isn't being added to the user; the command works for Organizational information (Department, two words, Company, 4 words), but not the address.

It's not vital, as I can use another directory sync app, but I'd prefer to use Powershell and GAM to get this done.

If anyone's interested, here's the entirety of the command I'm using:
$list = Import-Csv c:\!User_Accounts\New_Staff.csv
foreach ($entry in $list)
    {
      c:\gam_spschools\gam.exe create user $($entry.Email) firstname $($entry.Firstname) lastname $($entry.Lastname) password $($entry.Password) org $($entry.Path) organization name $($entry.Company) title $($entry.Title) department $($entry.Department) primary address type work Streetaddress $($entry.Address) primary phone type work value $($entry.Telephone) primary phone type work fax value $($entry.Fax) notprimary
    }

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



--



--

Andrew Penner

unread,
Oct 6, 2017, 1:50:13 PM10/6/17
to GAM for G Suite
Hi Ross:
gam info user ... does show the address information, whereas the admin console doesn't (nor does BetterCloud).
I'll try adding it as an unstructured address instead.
Thanks for the suggestion.


On Friday, October 6, 2017 at 10:58:11 AM UTC-6, Ross Scroggs wrote:
Andrew,

You may also want to try: gam.exe create user $($entry.Email) address type work unstructured $($entry.Address) primary

Ross
On Fri, Oct 6, 2017 at 9:24 AM, Ross Scroggs <ross.s...@gmail.com> wrote:
Andrew,

If you do a: gam info user some...@domain.com
What does the address field show?

Ross
On Fri, Oct 6, 2017 at 7:37 AM, Andrew Penner <andrew...@5565.ca> wrote:
Hi Ross, thanks for getting back to me.

Based on what I'd read elsewhere I thought that's how it would work, but the address information isn't being added to the user; the command works for Organizational information (Department, two words, Company, 4 words), but not the address.

It's not vital, as I can use another directory sync app, but I'd prefer to use Powershell and GAM to get this done.

If anyone's interested, here's the entirety of the command I'm using:
$list = Import-Csv c:\!User_Accounts\New_Staff.csv
foreach ($entry in $list)
    {
      c:\gam_spschools\gam.exe create user $($entry.Email) firstname $($entry.Firstname) lastname $($entry.Lastname) password $($entry.Password) org $($entry.Path) organization name $($entry.Company) title $($entry.Title) department $($entry.Department) primary address type work Streetaddress $($entry.Address) primary phone type work value $($entry.Telephone) primary phone type work fax value $($entry.Fax) notprimary
    }

--
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-ap...@googlegroups.com.



--



--

Andrew Penner

unread,
Oct 6, 2017, 3:01:44 PM10/6/17
to GAM for G Suite
Hi Ross:
Using "unstructured" did the trick, thanks.
Final question: any idea how I can get GAM or Google to recognize the Fax number?

Ross Scroggs

unread,
Oct 6, 2017, 3:41:56 PM10/6/17
to google-ap...@googlegroups.com
Andrew,

It should be ... phone type work_fax value $($entry.Fax) not primary ...

It's work_fax not work fax

If anyone's interested, here's the entirety of the command I'm using:
$list = Import-Csv c:\!User_Accounts\New_Staff.csv
foreach ($entry in $list)
    {
      c:\gam_spschools\gam.exe create user $($entry.Email) firstname $($entry.Firstname) lastname $($entry.Lastname) password $($entry.Password) org $($entry.Path) organization name $($entry.Company) title $($entry.Title) department $($entry.Department) primary address type work Streetaddress $($entry.Address) primary phone type work value $($entry.Telephone) primary phone type work fax value $($entry.Fax) notprimary 
    }

Ross

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-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-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.

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



--

Andrew Penner

unread,
Oct 6, 2017, 4:40:37 PM10/6/17
to GAM for G Suite
Thanks very much. I looked at the documentation I was able to find, but it wasn't really clear what the required field was named.
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-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-manager+unsub...@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.



--

Ross Scroggs

unread,
Oct 6, 2017, 4:45:32 PM10/6/17
to google-ap...@googlegroups.com
Andrew,

In the same folder as gam, there is a file GamCommands.txt with a complete syntax description; search for <UserAttributes>

Ross

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-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-manager+unsubscribe...@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.
To post to this group, send email to google-apps-manager@googlegroups.com.

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



--

Andrew Penner

unread,
Oct 6, 2017, 4:52:57 PM10/6/17
to GAM for G Suite
Never mind, I see it now. I think that chunk of text may just be overwhelming the first time you look at it; it does get easier with familiarity.

Andrew Penner

unread,
Oct 17, 2017, 2:45:45 PM10/17/17
to GAM for G Suite
So what's happened in the last week that Google no longer recognizes "not" when adding/updating the work_fax number:
          gam update user "x...@x.org" phone type work_fax value "(123) 456-7890" not primary
the command results in "ERROR: invalid argument (not) for account phone details"

Ross Scroggs

unread,
Oct 17, 2017, 2:54:34 PM10/17/17
to google-ap...@googlegroups.com
Andrew,

gam update user "x...@x.org" phone type work_fax value "(123) 456-7890" notprimary

There is no space between not and primary

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

Andrew Penner

unread,
Oct 17, 2017, 3:07:18 PM10/17/17
to GAM for G Suite
I swear to god I'm getting new glasses. Thanks!


Reply all
Reply to author
Forward
0 new messages