Bulk moving chrome os devices from one OU to another.

4,040 views
Skip to first unread message

Travis Epperson

unread,
May 17, 2018, 2:20:20 PM5/17/18
to GAM for G Suite
I track Chrome OS devices by class room and would like a single line bulk update to move all Chrome OS devices from one OU to another.

Something like i'm using for students (gam org "/Students/2nd graders" update user org "/Students/3rd graders")

I was thinking about something like (gam org "/Students/2nd graders" update cros org "/Students/3rd graders"), but of course that doesn't work since org defaults to users.

Rick Humphrey

unread,
May 17, 2018, 3:45:06 PM5/17/18
to GAM for G Suite
This is how I have done it in the pass
First I collected the device id for the devices I wanted to move. 

Then I have a batch file named "move devices.bat"
It contains
for /F "tokens=1" %%i in (crosdevicestomove.txt) do (
gam update cros %%i ou "Chrome Devices/Shared" >> movecros.log
)

The file crosdevicestomove.txt contains a list of device id I want to move
And in this example this I want to move it to "Chrome Devices/Shared"   OU

Hope this clear

Ross Scroggs

unread,
May 17, 2018, 4:04:09 PM5/17/18
to google-ap...@googlegroups.com
Travis,

gam update cros "query:orgunitpath:/Students/2nd graders" ou "/Students/3rd graders"


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/be011aa8-082b-48a0-bf5d-884a08d9113c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Travis Epperson

unread,
May 17, 2018, 4:24:54 PM5/17/18
to GAM for G Suite
That worked perfectly!!!  

Thanks!

I'm still struggling on the Syntax for GAM...  Is there any reference for the query:orgunitpath our there?  Seems like a very useful syntax to understand.


On Thursday, May 17, 2018 at 4:04:09 PM UTC-4, Ross Scroggs wrote:
Travis,

gam update cros "query:orgunitpath:/Students/2nd graders" ou "/Students/3rd graders"


Ross


On Thu, May 17, 2018 at 11:20 AM Travis Epperson <tra...@cobleschool.com> wrote:
I track Chrome OS devices by class room and would like a single line bulk update to move all Chrome OS devices from one OU to another.

Something like i'm using for students (gam org "/Students/2nd graders" update user org "/Students/3rd graders")

I was thinking about something like (gam org "/Students/2nd graders" update cros org "/Students/3rd graders"), but of course that doesn't work since org defaults to users.

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


--

Leen Jonkman

unread,
May 18, 2018, 2:53:26 AM5/18/18
to google-ap...@googlegroups.com

Op do 17 mei 2018 om 22:28 schreef Travis Epperson <tra...@cobleschool.com>:
That worked perfectly!!!  

Thanks!

I'm still struggling on the Syntax for GAM...  Is there any reference for the query:orgunitpath our there?  Seems like a very useful syntax to understand.

On Thursday, May 17, 2018 at 4:04:09 PM UTC-4, Ross Scroggs wrote:
Travis,

gam update cros "query:orgunitpath:/Students/2nd graders" ou "/Students/3rd graders"


Ross


On Thu, May 17, 2018 at 11:20 AM Travis Epperson <tra...@cobleschool.com> wrote:
I track Chrome OS devices by class room and would like a single line bulk update to move all Chrome OS devices from one OU to another.

Something like i'm using for students (gam org "/Students/2nd graders" update user org "/Students/3rd graders")

I was thinking about something like (gam org "/Students/2nd graders" update cros org "/Students/3rd graders"), but of course that doesn't work since org defaults to users.

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


--

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

Travis Epperson

unread,
May 18, 2018, 6:26:38 AM5/18/18
to GAM for G Suite
I must be missing something because I have been through the wiki and other then a short bulk section there wasn't anything that really talks about the syntax of creating complex commands.  In fact I haven't seen the syntax used anywhere :query:orgunitpath

I understand the basic stuff, but i'm trying to figure out the complex tie in commands.  I would normally assume pipe commands would need to be used if it was something happening at the OS level so i'm surprised by the :query: command...  In fact I haven't seen reference to : anywhere in the syntax.  Is this maybe stepping out to the API directly?

Sorry for the questions, I would just love to understand the complex syntax so I can do things without having to write bash for every complex syntax.

Thanks!

On Friday, May 18, 2018 at 2:53:26 AM UTC-4, Leen Jonkman wrote:
Op do 17 mei 2018 om 22:28 schreef Travis Epperson <tra...@cobleschool.com>:
That worked perfectly!!!  

Thanks!

I'm still struggling on the Syntax for GAM...  Is there any reference for the query:orgunitpath our there?  Seems like a very useful syntax to understand.

On Thursday, May 17, 2018 at 4:04:09 PM UTC-4, Ross Scroggs wrote:
Travis,

gam update cros "query:orgunitpath:/Students/2nd graders" ou "/Students/3rd graders"


Ross


On Thu, May 17, 2018 at 11:20 AM Travis Epperson <tra...@cobleschool.com> wrote:
I track Chrome OS devices by class room and would like a single line bulk update to move all Chrome OS devices from one OU to another.

Something like i'm using for students (gam org "/Students/2nd graders" update user org "/Students/3rd graders")

I was thinking about something like (gam org "/Students/2nd graders" update cros org "/Students/3rd graders"), but of course that doesn't work since org defaults to users.

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


--

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

+KimNilsson

unread,
May 22, 2018, 8:27:31 AM5/22/18
to GAM for G Suite
Travis, if you check the wiki by Ross you will find more syntax.
However, that is closely connected to his fork of GAM, called GAMADV-X.
Many commands work also on regular GAM, but there are no guarantees.

Ross Scroggs

unread,
May 22, 2018, 5:21:46 PM5/22/18
to google-ap...@googlegroups.com
Travis,

In my Advanced Gam (https://github.com/taers232c/GAMADV-X) or (https://github.com/taers232c/GAMADV-XTD) there are many ways to specify collections of CrOS devices.

In your case the command would be:
gam cros_ou "/Students/2nd graders" update ou "/Students/3rd graders"

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.

For more options, visit https://groups.google.com/d/optout.


--

Travis Epperson

unread,
May 24, 2018, 10:39:22 PM5/24/18
to GAM for G Suite
Thanks!  This really helps.

Travis Epperson

unread,
May 24, 2018, 10:39:36 PM5/24/18
to GAM for G Suite
Thanks!

✉ Kevin Melillo

unread,
May 25, 2018, 9:24:16 AM5/25/18
to google-ap...@googlegroups.com
Not sure how much of a help this would be, since it is not totally GAM related, but more of a work-flow thing.

Create your ORGs based on graduation year.  So if it is a K-8 school, and the student is in 4th grade this year, his graduation year would be 2022.  So have the student in 

/Students/2022

That way you would only have to make changes if a Student for whatever reason does not move from one year to the next.

Depending on your work-flow, this may not be possible, so I just thought I would suggest it...  that way, you don't have to re-assign Chromebooks for every student, every year.  Save some time!

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

For more options, visit https://groups.google.com/d/optout.


--
Kevin Melillo
Electronic Communications Analyst
Information Technology
445 Hoes Lane
Piscataway, NJ 08854

Phone:732-465-6609 | Mobile: 732-609-4331

Kyle Curtis

unread,
Aug 21, 2019, 9:12:40 AM8/21/19
to GAM for G Suite
I tried to modify this to: gam update cros "query:id:[asset id]" ou "/Main OU/Sub OU/Sub Sub OU"
I don't seem to get any errors but the device neve appears in the specified ou. Am I doing something wrong


On Thursday, May 17, 2018 at 1:04:09 PM UTC-7, Ross Scroggs wrote:
Travis,

gam update cros "query:orgunitpath:/Students/2nd graders" ou "/Students/3rd graders"


Ross


On Thu, May 17, 2018 at 11:20 AM Travis Epperson <tra...@cobleschool.com> wrote:
I track Chrome OS devices by class room and would like a single line bulk update to move all Chrome OS devices from one OU to another.

Something like i'm using for students (gam org "/Students/2nd graders" update user org "/Students/3rd graders")

I was thinking about something like (gam org "/Students/2nd graders" update cros org "/Students/3rd graders"), but of course that doesn't work since org defaults to users.

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


--
Ross Scroggs

Kim Nilsson

unread,
Aug 21, 2019, 9:16:56 AM8/21/19
to Google Apps Manager
Some times there's a delay between API call and visible result. What if you check the device OU with GAM, and not in the admin console? 

dbmct

unread,
Jan 22, 2020, 3:27:51 PM1/22/20
to GAM for G Suite
Here is a way that I have done it using gam

<#>
Move all devices from one OU to another using start and end OUs defined in a separate TXT file
Example csv txt file
StartOU,EndOU
"/Testing","/chrome devices/IT Deptmartment/Extras"
</#>
$CSV = "C:\test\UserCrosDevices\SwapDeviceOU.txt"
$Data = Import-Csv $CSV
foreach($Line in $Data) {
$StartOU = $Line.StartOU
$EndOU = $Line.EndOU
$Devices = gam print cros limittoou "$StartOU" | Select -Skip 1
foreach($DeviceID in $Devices) {
gam update cros $DeviceID ou "$EndOU"
}
}

Ross Scroggs

unread,
Jan 22, 2020, 3:50:18 PM1/22/20
to google-ap...@googlegroups.com

You can replace this:

$Devices = gam print cros limittoou "$StartOU" | Select -Skip 1

foreach($DeviceID in $Devices) {

gam update cros $DeviceID ou "$EndOU"


    }


with this:

gam update cros "query:orgunitpath:$StartOU" ou "$EndOU"



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 view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/b2e24168-b3a8-4d56-a56e-ff9193ed3077%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages