Update location field based on OU

51 views
Skip to first unread message

Dale Grant

unread,
Oct 20, 2023, 6:43:22 AM10/20/23
to GAM for Google Workspace
Hi there,

Would anyone be able to help with a script which can be run to update the location field of all Chromebooks based on the OU which they are in?

Many Thanks!

Robert Fine

unread,
Oct 20, 2023, 7:33:54 AM10/20/23
to GAM for Google Workspace

Hi Dale, 

use the update location for the chromebooks in gam, and run the command for the OU. 

gam cros_ou "/path/to/OU" update location <location>

Ross Scroggs

unread,
Oct 20, 2023, 8:04:36 AM10/20/23
to google-ap...@googlegroups.com
Dale,

If you want to update multiple OU locations make a CSV file OuLocations.csv with two columns: OU,Location
OU,Location
/Path/to/OU1,Location1
/Path/to/OU2,Location2
...

gam csv OuLocations.csv gam cros_ou "~OU" update location "~Location"

Ross
----
Ross Scroggs



--
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/6a730f13-8ad1-476c-9ea8-371ede4b9854n%40googlegroups.com.

Dale Grant

unread,
Oct 23, 2023, 10:25:59 AM10/23/23
to GAM for Google Workspace
Hi there Robert,

When I run the command:

gam cros_ou "/Devices/Admin" update location testlocation

I get the following error:

ERROR: location is not a valid argument for "gam <users> update"

Am I doing something stupid?

Thanks!

Ross Scroggs

unread,
Oct 23, 2023, 11:18:04 AM10/23/23
to google-ap...@googlegroups.com
Dale,

You're running Standard GAM, the command Robert gave works in Advanced GAM. You have to do two steps:
gam print cros cros_ou "/Devices/Admin" > cros.csv
gam csv cros.csv gam update cros "~deviceId" location testlocation

Ross

----
Ross Scroggs



--
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.
Reply all
Reply to author
Forward
0 new messages