Moving users from one OU to another

8,701 views
Skip to first unread message

Tom Elledge

unread,
Jul 8, 2016, 9:59:16 PM7/8/16
to Google Apps Manager
I need to move students from one OU  (/xxx.org/Elementary School/3) to another (/xxx.org/Intermediate School/4). I have tried all of the suggestions given in other posts but have been unsuccessful.  Any ideas? GAM Version 3.65

The vision of the Baker County School District is to prepare individuals to be lifelong learners, self-sufficient, and responsible citizens of good character.

Bri Hatch

unread,
Jul 8, 2016, 11:54:52 PM7/8/16
to google-ap...@googlegroups.com
a) create a file users.txt w/ all the usernames in it you wish to move, one per line

b) save this file as domoves.sh

#!/bin/bash
for user in $(cat users.txt)
do
  gam update user $user org /xxx.org/Intermediate
done

c) run 'bash -x domoves.sh'

there are probably ways to glue output of one gam csv command to another gam csv command to make this more streamlined, but I'm a fan of simple.



On Thu, Jul 7, 2016 at 1:32 PM, Tom Elledge <thomasm...@bakerk12.org> wrote:
I need to move students from one OU  (/xxx.org/Elementary School/3) to another (/xxx.org/Intermediate School/4). I have tried all of the suggestions given in other posts but have been unsuccessful.  Any ideas? GAM Version 3.65

The vision of the Baker County School District is to prepare individuals to be lifelong learners, self-sufficient, and responsible citizens of good character.

--
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/588f9634-156a-4a63-ae15-f264b4e4bb9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Bri Hatch, Systems and Security Engineer. http://www.ifokr.org/bri/

The sooner you fall behind, the more time you'll have to catch up.

Ross Scroggs

unread,
Jul 9, 2016, 1:36:47 AM7/9/16
to google-ap...@googlegroups.com
Tom/Bri,

Two approaches based on what you're trying to do.

If you want to move some of the students in "/xxx.org/Elementary School/3" to "/xxx.org/Intermediate School/4", then Bri was close but there is a simpler way.
gam org "/xxx.org/Elementary School/3" print > users.txt
Delete the non-moving students from users.txt
gam file users.txt update user org "/xxx.org/Intermediate School/4"

If you want to move all of the students in "/xxx.org/Elementary School/3" to "/xxx.org/Intermediate School/4", then there is a one-liner.
gam org "/xxx.org/Elementary School/3" update user org "/xxx.org/Intermediate School/4"

Jackie Ernst

unread,
Jul 21, 2016, 9:45:12 PM7/21/16
to Google Apps Manager
I have a file named user.txt with two students because I want to test it first.  It contains ONLY their email address.  They are suspended accounts.

At the command prompt in C:\GAM I wrote the following:

gam file users.txt update user org "/Suspended Accounts/Students"

>> I get ERROR:  user is not a valid argument for "gam"

What am I doing wrong?

Thanks!!!
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.



--
Bri Hatch, Systems and Security Engineer. http://www.ifokr.org/bri/

The sooner you fall behind, the more time you'll have to catch up.


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

Ross Scroggs

unread,
Jul 21, 2016, 10:46:12 PM7/21/16
to google-ap...@googlegroups.com
Jackie,

You want: gam file users.txt update user org "/Suspended Accounts/Students"

The style you used is for updating one user.

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.

Jackie Ernst

unread,
Jul 22, 2016, 1:12:17 AM7/22/16
to Google Apps Manager
BAM!!!  You be the ever brilliant rock star!!!

THANK YOU!!

Tom Elledge

unread,
Jul 25, 2016, 3:41:30 PM7/25/16
to Google Apps Manager
Thanks Ross! I have been vacationing for the last two weeks and just got back to this issue.  I tried the one-liner (which I prefer, and gotthe error: Error 400: Invalid Input: INVALID_OU_ID - invalid. I also tried the other approach printing to text and removing students and get the same error.  I have checked the org OU and it is correct and have played with the syntax to no avail. I ran the gam print orgs and double checked the OU name and it is correct. What am I doing wrong?
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.



--
Bri Hatch, Systems and Security Engineer. http://www.ifokr.org/bri/

The sooner you fall behind, the more time you'll have to catch up.


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

Tom Elledge

unread,
Jul 25, 2016, 4:44:18 PM7/25/16
to Google Apps Manager
Nevermind...I think I fixed the issue. I was including the root xxx.org and should only have put the sub ou. In any event it is working now. Thanks for the help.
Reply all
Reply to author
Forward
0 new messages