Move chromebooks to OU by assetid

2,110 views
Skip to first unread message

Scott Meyer

unread,
Jul 12, 2016, 2:44:56 PM7/12/16
to Google Apps Manager
I need to move 4300 chromebooks to OU based upon spreadsheets I have with just their assetid in them. (spreadsheet contains a single column titled assetid)


The commands I have tried either error out, or never complete (after an hour of processing time).

gam csv site1.csv gam update cros query:assetid:~assetid ou '/Site1/Students'
starting 5 worker threads
Error 400: Invalid input: assetid:~assetid - invalid

gam csv site1.csv gam print cros query:assetid:~assetid ou '/Site1/Students'
starting 5 worker threads
(after 15 minutes no results)

Any ideas?

Jay Lee

unread,
Jul 12, 2016, 2:46:44 PM7/12/16
to Google Apps Manager

Try:

gam csv site1.csv gam update cros query:asset_id:~~assetid~~ ou '/Site1/Students'


--
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/f1aed76a-ac29-4a67-8fbd-8b8e2c129efd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Jay

Scott Meyer

unread,
Jul 12, 2016, 3:30:27 PM7/12/16
to Google Apps Manager
That got me close!!!

Close enough that I could figure it out!!!

What finally worked was:
gam update cros "query:asset_id:'123456'" ou "/Site1/Students"

Now attempting to make this a gam csv command...
gam csv site1.csv gam update cros "query:asset_id:'~~assetid~~'" ou "/Site1/Students"
starting 5 worker threads...

nothing... back to CLI (whereas the above individual command that worked gave me the device id of the chromebook)
gam csv site1.csv gam update cros "query:asset_id:~~assetid~~" ou "/Site1/Students"  (no single quotes around ~~assetid~~)
did the same thing

What am I missing?


On Tuesday, July 12, 2016 at 1:46:44 PM UTC-5, Jay Lee wrote:

Try:

gam csv site1.csv gam update cros query:asset_id:~~assetid~~ ou '/Site1/Students'


On Tue, Jul 12, 2016, 2:44 PM Scott Meyer <scott...@roughers.net> wrote:
I need to move 4300 chromebooks to OU based upon spreadsheets I have with just their assetid in them. (spreadsheet contains a single column titled assetid)


The commands I have tried either error out, or never complete (after an hour of processing time).

gam csv site1.csv gam update cros query:assetid:~assetid ou '/Site1/Students'
starting 5 worker threads
Error 400: Invalid input: assetid:~assetid - invalid

gam csv site1.csv gam print cros query:assetid:~assetid ou '/Site1/Students'
starting 5 worker threads
(after 15 minutes no results)

Any ideas?

--
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-manager+unsub...@googlegroups.com.
--

Jay

Bryan Guidroz

unread,
Jul 12, 2016, 4:29:37 PM7/12/16
to Google Apps Manager
I do something very similar.  Here is my command.  I have no quotes and it works.
gam csv siteList.csv gam update cros query:id:~~SerialNumber~~ ou ~OU location ~Site



--

Jay

Scott Meyer

unread,
Jul 14, 2016, 8:39:49 AM7/14/16
to Google Apps Manager
Just to document, your answer is the correct answer...

gam csv site1.csv gam update cros query:asset_id:~~assetid~~ ou /Site1/Students

is a working script for my needs.  GAM looks up the asset_id (in the spreadsheet named site1.csv with a header row of assetid), matches that with the asset_id in Google Apps, then moves the device to the /Site1/Students OU.

Thank you everyone for your assistance!

Michael Hattayer

unread,
Jul 19, 2016, 10:33:24 AM7/19/16
to Google Apps Manager
Good to know this is possible with queries. For anybody looking for an alternative solution, I currently use excel's VLOOKUP function to accomplish this task (I use excel formulas to generate all commands) 

=VLOOKUP(A2,Devices!$A$1:$G$3000,2,FALSE)

A2 is the input (serial number in my case, but could easily be asset tag). My devices table slightly reformats the output from my 'cros print' export to list serialNumber in the A column (once again could easily be annotatedAssetId) and deviceId in column B.

From there, I use an excel formula to modify the 'gam update' syntax with info provided in C2, D2, E2, and F2 (asset tag, org unit, location, and user respectively). I then put the 100+ jobs I typically create into a .txt file and use "gam batch"

Kind of a roundabout solution but makes it easier for other techs to understand what's happening in the template. A bit beefy to set up originally, however in practice is very simple to utilize (just copy + paste information handed to me by users/techs) 
Reply all
Reply to author
Forward
0 new messages