Bulk update Employee information

1,351 views
Skip to first unread message

Rodrigo S

unread,
Jul 25, 2018, 1:44:15 PM7/25/18
to GAM for G Suite

Hi Folks,


Could someone indicate me if is possible update the data for bulk users?, approximately 10 thousn accounts.- thanks a lot for any comment.-



Unhappy Buckaroo

unread,
Jul 25, 2018, 2:10:52 PM7/25/18
to GAM for G Suite
Hi Rodrigo:

I currently use a .csv file with a powershell script to update staff. The .csv file uses the headers "Email", "Path", "Title", "Department", etc. The script is:

$list = Import-Csv "\\path\to\file.csv"
foreach ($entry in $list)
{
  c:\gam\gam.exe update user $($entry.Email) org $($entry.Path) organization title $($entry.Title) department $($entry.Department) primary address type work unstructured $($entry.Address) primary phone type work value $($entry.Telephone) primary phone type work_fax value $($entry.Fax) notprimary
    }

​This works for maybe a few hundred at a time if speed isn't a huge issue. If you're going to be updating thousands, you'll want to run a batch file.

Each line of the batch file will be a separate command, one for each user. You can use a spreadsheet to simplify creating the commands, but you'd be looking at something like:

gam update user us...@domain.com organization title Title1 department Dept.1
gam update user us...@domain.com organization title Title2 department Dept.2
gam update user us...@domain.com organization title Title3 department Dept.3

Save the file as .bat. To run the batch file the command is:
gam batch name_of_batch_file.bat 

Ross Scroggs

unread,
Jul 25, 2018, 2:15:10 PM7/25/18
to google-ap...@googlegroups.com
Rodrigo,

Yes, you have some preparation to do. Here are all of a user's attributes; you'll be using externalid, organization and relation.

<UserAttributes> ::=

        (address clear|(type work|home|other|(custom <String>) [unstructured|formatted <String>] [pobox <String>] [extendedaddress <String>] [streetaddress <String>]

                [locality <String>] [region <String>] [postalcode <String>] [country <String>] [countrycode <String>] notprimary|primary))|

        (admin <Boolean>)|

        (agreed2terms|agreedtoterms <Boolean>)|

        (changepassword|changepasswordatnextlogin <Boolean>)|

        (crypt|sha|sha1|sha-1|md5|nohash)|

        (customerid <String>)|

        (email|primaryemail|username <EmailAddress>)|

        (otheremail clear|(work|home|other|<String> <String>))|

        (externalid clear|(account|customer|login_id|network|organization|<String> <String>))|

        (firstname|givenname <String>)|

        (gal|includeinglobaladdresslist <Boolean>)|

        (gender clear|(female|male|unknown|(other <String>) [addressmeas <String>]))|

        (im clear|(type work|home|other|(custom <String>) protocol aim|gtalk|icq|jabber|msn|net_meeting|qq|skype|yahoo|(custom_protocol <String>) <String> [notprimary|primary]))|

        (ipwhitelisted <Boolean>)|

        (keyword clear|(occupation|outlook|(custom <string>) <String>))|

        (language clear|<LanguageList>)|

        (lastname|familyname <String>)|

        (location clear|(type default|desk|<String> area <String> [building|buildingid <BuildingID>] [floor|floorname <FloorName>] [section|floorsection <String>] [desk|deskcode <String>] endlocation))|

        (note clear|([text_plain|text_html] <String>|(file <FileName> [charset <Charset>])))|

        (organization clear|([type domain_only|school|unknown|work] [customtype <String>] [name <String>] [title <String>] [department <String>] [symbol <String>]

                [costcenter <String>]  [location <String>] [description <String>] [domain <String>] notprimary|primary))|

        (org|ou|orgunitpath <OrgUnitPath>)

        (password random|<Password>)|

        (phone clear|([type work|home|other|work_fax|home_fax|other_fax|main|company_main|assistant|mobile|work_mobile|pager|work_pager|car|radio|callback|isdn|telex|tty_tdd|grand_central|(custom <String>)]

                [value <String>] notprimary|primary))|

        (posix clear|(username <String> uid <Integer> gid <Integer> [system|systemid <String>] [home|homedirectory <String>] [shell <String>] [gecos <String>] [primary <Boolean>] endposix))|

        (relation clear|(spouse|child|mother|father|parent|brother|sister|friend|relative|domestic_partner|manager|dotted-line_manager|assistant|admin_assistant|exec_assistant|referred_by|partner|<String> <String>))|

        (sshkeys clear|(key <String> [expires <Integer>] endssh))|

        (suspended <Boolean>)|

        (website clear|(home_page|blog|profile|work|home|other|ftp|reservations|app_install_page|<String> <URL> [notprimary|primary]))|

        (<SchemaName>.<FieldName> [multivalued|multivalue|value|multinonempty [type work|home|other|(custom <String>)]] <String>)


Make a CSV file EmployeeInfo.csv with these columns (order doesn't matter, omit columns you don't use):
UserEmail,EmployeeID,JobTitle,EmployeeType,Department,CostCenter,ManagersEmail

This command will do the updates (omit fields you don't use(
gam csv EmployeeInfo.csv gam update user "~UserEmail" externalid organization "~EmployeeID" organization type work title "~JobTitle" description "~EmployeeType" department "~Department" costcenter "~CostCenter" primary relation manager "~ManagersEmail"

Test with some sample users.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/14faed10-387c-4ac9-aa5d-83a41f5ccaaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Rodrigo Sepulveda

unread,
Jul 25, 2018, 2:23:47 PM7/25/18
to google-ap...@googlegroups.com
Thanks a lot for your answer I will try, Once done I will could confirm 

Ross

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.


--

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



--
Atte.
Rodrigo Sepulveda Ubilla

Rodrigo Sepulveda

unread,
Jul 25, 2018, 3:24:30 PM7/25/18
to google-ap...@googlegroups.com
I confirm you is working very well, thanks so much for all support.- regards.-

Ross

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+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.
--
Atte.
Rodrigo Sepulveda Ubilla
Reply all
Reply to author
Forward
0 new messages