Bulk Update Chrome OS Devices from a CSV

4,550 views
Skip to first unread message

Mark Blair

unread,
Nov 1, 2013, 1:31:12 PM11/1/13
to google-ap...@googlegroups.com
With GAM is it possible to take a csv file of Chromebook serial numbers and bulk update the OU and Location fields?

Thanks in advance,

Mark

GL Sterritt

unread,
Aug 7, 2014, 11:31:03 PM8/7/14
to google-ap...@googlegroups.com
From the looks of this response from Jay Lee, yes: 


To update one device, you can use a command like:

gam update cros query:id:<device serial number> ou "/Your OU"

to update multiple devices at once is possible but is going to take a bit more work. The easiest way would probably be to make copies of all your CSV files and then prefix the serial numbers in each row with "query:id:". Then you can run:

gam csv myfile.csv gam update cros ~serial ou "/New OU"

where myfile.csv is your CSV file and serial is the header of the column which contains "query:id:<serial#>" information.

Hopefully I can loop back and confirm in my environment in the next couple weeks, and that it's not too late to help you. 

GL Sterritt

unread,
Aug 7, 2014, 11:33:40 PM8/7/14
to google-ap...@googlegroups.com
Oh, another related post, this time about updating location instead of moving OU: 


gam update cros <device-id> user <user> location <location> notes <notes>

There was a bug before where you needed to modify the script because of annotatedLocation being mistyped as anotatedLocation, but that was fixed after 3.03. 

Bryan Guidroz

unread,
Jan 27, 2016, 1:05:32 PM1/27/16
to Google Apps Manager
I've got this working, but is it possible to do something like this after the notes portion.
Concatenating text from the csv file into one field?

gam csv myfile.csv gam update cros ~serial ou ~NewOU location ~Site notes "PO: " ~PO  "| Invoice Date: " ~InvDate

If so, what would be the proper syntax?
Thanks

Jay Lee

unread,
Jan 27, 2016, 1:19:02 PM1/27/16
to Google Apps Manager
Make sure you've upgraded to GAM 3.62 and try:

gam csv myfile.csv gam update cros ~serial ou ~NewOU location ~Site notes "PO: ~~PO~~ | Invoice Date: ~~InvDate~~"

This does assume "serial" column in your CSV is actually the deviceId, if it's actually the serialNumber field use:

gam csv cros.csv gam update cros query:id:~~serialNumber~~ notes "SN: ~~serialNumber~~ id: ~~deviceId~~"

this is slower because it first needs to lookup the deviceID which has the given serialNumber but it should still work.

As you can probably tell from the examples, ~~column~~ now allows for replacing part of an argument with the CSV cell value.

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 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/0484305c-d9a5-4a80-a792-d5921a029e56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Jay Lee

Bryan Guidroz

unread,
Jan 27, 2016, 3:32:50 PM1/27/16
to Google Apps Manager
That's it.  Worked like a charm.  Thanks so much!!!
And, with the " query:id:~~serialNumber~~ " I now don't have to modify the original spreadsheet like I was (adding "query:id: to the serial number column of the spread sheet.)
You the man! :)


On Friday, November 1, 2013 at 12:31:12 PM UTC-5, Mark Blair wrote:

+KimNilsson

unread,
Jan 31, 2016, 5:59:15 AM1/31/16
to Google Apps Manager
Yeah, GAM is awesome.
But, don't forget that there are also other tools made specifically for certain tasks.
Sometimes it's easier to use something like the addon chromebook inventory to do what you were trying to do.
Especially as it pulls down all the current information about your enrolled chromebooks directly into a spreadsheet in your Drive.
Then easily lets you manipulate whatever you want in a familiar environment, and then allows you to just upload it, updating everything at once.
Also, if you only want to grab portions of your CBs you can choose which OU to dowload from.
Even if you grab everything, if you remove unnecessary rows from the sheet before uploading, it only affects those.
Reply all
Reply to author
Forward
0 new messages