Multi-step process for updating Chromebook data

177 views
Skip to first unread message

Seth Dimbert (Hillel Yeshiva)

unread,
Oct 6, 2021, 2:49:23 PM10/6/21
to GAM for Google Workspace
I have some updates I have to perform on my Chromebooks. We manage them in an Asset database and I want to update their OUs based on data stored in that database.

My Chromebook OUs are structured as follows:

 - Chromebook Carts
 -  - ES Classrooms
 -  -  - Core Classroom Carts
 -  -  -  - Core Room 01 Cart
 -  -  -  - Core Room 02 Cart
 -  -  - ES Room 01 Cart
 -  -  - ES Room 02
 -  -  - ES Room 03
 -  -  - ES Room 04
 -  -  - ES Room 05
 -  -  - ES Room 06
 -  -  - ES Room 07
 -  -  - ES Room 08
 -  -  - ES Room 09
 -  -  - ES Room 10
 -  -  - ES Room 11
 -  -  - ES Room 12

So, my first question is: How must I format an OU path like /Chromebook Carts/ES Classrooms/Core Classroom Carts/Core Room 01 Cart given all of the spaces in the names? 

The first task I have to perform is to move all of the devices in all of the ES OUs up to the Chromebook Carts OU. So I need to tell GAM to modify all of the Chromebooks in "ES Classrooms" and all child OUs to a new OU.

My next task will be to utilize a CSV to modify the AssetID and OU of many devices (identified by serial number) to, essentially, place them back into the correct OUs.

Can someone help me with this process?

-SD

Seth Dimbert (Hillel Yeshiva)

unread,
Oct 7, 2021, 3:51:53 PM10/7/21
to GAM for Google Workspace
First of all, thank you, Ross, for taking the time to explain this entire process to me. I am always amazed by how generous you are with your time and expertise. Also, as an educator, I appreciate how you took the time to make sure I understood these commands and then asked me to be the one to provide the answers to my own questions. #SeeOneDoOneTeachOne :)

The problem
I have a pile of OUs (see my original post for the hierarchy) which contain Chromebooks and many of them are in the wrong OU. I want to reassign OUs (and verify AssetIDs while I'm at it), using data exported from my Asset Tracking database. So, I want to:
  1. Pull all of the Chromebooks out of the hierarchy of child OUs and place them in a temporary location, then...
  2. ...use a Google Sheet to update the AssetID and OU of each Chromebook, effectively "putting them all back where they belong."
This is complicated by the fact that I have the device's serial numbers, but the Google API wants me to identify them by deviceID, Luckily, GAM can use a serial to look up and then use a deviceID, which is cool. Read on. :)

Part One
The first command I used is:

gam update ou "Path/to/DestinationOU" move cros_ou_and_children "Path/to/SourceOU" quickcrosmove

This says, "Hey GAM, let's make a change to DestinationOU. The change we are going to make is to move all of the devices in SourceOU (and any OUs inside it) into DestinationOU. And let's do that using the quickcrosmove method (more info), which means that we aren't doing to balk if there are any errors along the way."

Presto... the devices have moved and all of the other OUs are empty.

Part Two
Now it's time to update those Chromebooks. I want to verify their AssetIDs and assign them new OUs, all with data pulled from a Google Sheet I created. The schema of that sheet is simply:

assetid | serial | location | ou

This is fairly straightforward but Ross showed me some cool stuff here, too. Here is the command:

gam csv gsheet <username> id <sheetID> <sheetname> gam update cros cros_sn ~SN_Column assetID ~assetCol ou ~OU_col

There are two parts... each starts with "gam.:"
  1. The first part says, "Hey GAM, I have a Google Sheet, owned by the user named <username> with the ID <sheetID>. Inside, on the individual sheet called <sheetname>, there's some data I want to use for the second part of this command...
  2. ...which says, "GAM, for each row on that sheet, I want to update a ChromeOS device identified by the serial number in SN_Column. For each one, replace the assetID with the number from AssetCol and replace the OU with whatever is in OU_Col.

The cool, extra part here is the cros_sn command (more info). That little guy tells GAM, "Look, I know you want a DeviceID, but I don't have one. So I'm going to provide you with a Serial Number. Just take that, go look up the associated DeviceID where ever you keep it and then use that device."

So, that's what I did, and it worked great. :)

Thanks again, Ross. 

-SD

Jake Cohen

unread,
Sep 16, 2022, 1:37:53 PM9/16/22
to GAM for Google Workspace
Hello everyone, 

Found this old thread and I wanted to know if someone could help me by checking my commands before I go and screw up all the serial numbers and asset tags in my system! I am a GAM noob and it's been years since I've properly Python'd, so wanted to be sure I'm approaching this correctly.

I am looking to change the Asset IDs of all my Chromebooks since we recently got a new asset management system. 

I have created a Google Sheet with only 2 columns: my serial numbers and the new asset IDs (columns are named serial and assetID). The sheet is under my username (j****@b***.org), and has a spreadsheetID of 1f7qMDH35R7Fl5dBNPBVuTL_Bi9JaWVM95nqFY0tvLXE and a sheetID of 0. 

This is the command I was planning to use:
gam csv gsheet j****@b***.org spreadsheetID 1f7qMDH35R7Fl5dBNPBVuTL_Bi9JaWVM95nqFY0tvLXE id 0 gam update cros cros_sn ~serial assetID ~assetID

Anyone willing to proofread this for me? Thanks so much in advance!

-Jake


Confidentiality Notice:
This e-mail, including any attachments, is the property of The Bement School and is intended for the sole use of the intended recipient(s).  It may contain information that is privileged and confidential.  Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, please delete this message, and reply to the sender regarding the error in a separate email.

Ross Scroggs

unread,
Sep 16, 2022, 1:51:18 PM9/16/22
to google-ap...@googlegroups.com
Jake,

It looks right to me; test with a CSV with a header and one row.

Ross

--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/da9098a4-a0f5-4b00-aaed-652a214cff6bn%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages