Classroom

Print Classroomprofile

The classroomprofile gives basic info about users access to Google Classroom.

Single User

gam user <User Email Address> print classroomprofile todrive

For an OU

This can show the verified teachers and those with permission to create classrooms.

gam ou_and_children_ns </Path/To/OU> print classroomprofile todrive

Print Courses

Archived after

gam redirect csv ./OldArchivedCourses.csv print courses states archived timefilter creationtime end yyyy-mm-dd todrive

Teacher

gam print courses teacher <User Email Address> todrive

gam print courses teacher <User Email Address> fields name,id

Student

gam print courses student <User Email Address> todrive

Courses

Show all courses but limit the fields retreived.

gam print courses fields name,alternatelink

To get the Course ID, run this for the specific user

gam print courses teacher <User Email Address> todrive

Or, to only show active courses

gam print courses teacher <User Email Address> state active todrive

All Owners

Print off all the owner emails (and ownerID) for all the classes. 

gam print courses todrive fields owneremail

Course Owner

For a specific Course

gam print courses course <CourseID> fields owneremail

Classrooms with 0 Students

This command will search the active & provisioned courses. The todrive option on the end will create a Google Sheet of the results, as well as the nostudentcourses.csv file. If this is not added you will need to analyse the nostudentcourses.csv.

gam config csv_output_row_filter "students:count=0" redirect csv nostudentcourses.csv print courses show students countsonly states active,provisioned fields name,coursestate todrive

CreationTime

To find the courses created on a specific date use date=. However date< and date> can be used.

gam config csv_output_row_filter "creationTime:date=yyyy-mm-dd" print courses

For a date range

gam print courses timefilter creationTime start yyyy-mm-dd end yyyy-mm-dd todrive

Orphaned Courses

gam config csv_output_row_filter "ownerEmail:regex:'Unknown user'" redirect csv ./OrphanCourses.csv print courses fields name,owneremail

Course-Announcements

Course

Where <Course ID> is the 'Classroom ID'

gam print course-announcements course <Course ID>

Print Course-Participants

Teachers & Students

gam print course-participants course <Course ID> todrive

Teachers only

gam print course-participants course <Course ID> show teachers todrive

Print Course-Submissions

All Courses

Change the date range as required.

gam print course-submissions fields courseid,courseworkid,id,state,creationtime,userid start -1d end -0d todrive

Specific Course

gam print course-submissions course <Course ID> fields courseid,courseworkid,id,state,creationtime,userid start -1d end -0d todrive

Print Course-Work

Student Assignments

gam print course-work student <Student Email Address> showtopicnames fields title,topicid todrive

Show Classroomprofile

The classroomprofile gives basic info about users access to Google Classroom.

Single User

gam user <User Email Address> show classroomprofile

Sync (Course Members)

Sync can be used to update Google Classroom (Course Members) by adding/removing users listed in groups or OUs. Change teachers to students as needed.

Group

gam courses <Course ID> sync teachers group <Group Email Address>

OU

gam courses <Course ID> sync teachers ou "</Path/To/OU>"

classroominvitations

Classroom

gam show classroominvitations course <Course ID>

gam print classroominvitations course <Course ID> todrive

User

gam user <User Email Address> show classroominvitations

Delete

gam user <User Email Address> delete classroominvitation ids <Invitation ID>

Guardian Invitations

Print

gam print guardians invitations ou_and_children </Path/To/OU> todrive

Add

gam user <Student Email Address> add guardian <Guardian Email Address>

Remove

gam user <Student Email Address> delete guardian <Guardian Email Address>

View Guardian Invitations for a Student

gam user <Student Email Address> show guardian invitations

gam user <Student Email Address> show guardian invitations state [pending | complete]

View Classes

All the Classes for Teachers in an OU

Change ou to ou_and_children for users in the OU and sub-OUs.

gam ou </Path/To/OU> print users primaryemail | gam redirect csv ./Teachers.csv multiprocess csv - gam print courses teacher ~primaryEmail fields id,name,owneremail todrive

For a Google Group of Teachers

gam group <Group Email Address> print users primaryemail | gam redirect csv ./Teachers.csv multiprocess csv - gam print courses teacher ~primaryEmail fields id,name,owneremail todrive

For a CSV list of Teachers

gam redirect stdout - multiprocess redirect stderr stdout redirect csv ./TeacherCourses.csv multiprocess csv Teachers.csv gam print courses teacher "~email" fields id,name,ownerid owneremail alias todrive

View All Classes

View active and provisioned Classrooms.

gam print courses state active,provisioned owneremail todrive

Add Users To a Class

From an OU

Get the users of an OU

gam ou <Path/To/OU> print users fields primaryEmail > list_of_users.csv

From CSV

gam csv list_of_users.csv gam course ~id add [student | teacher] ~primaryEmail

From Google Sheet

gam csv gsheet <User Email Address> <Google Sheet ID> <Sheet (Tab) Name> gam course ~id add teacher <New Teacher Email>

Change Owner

This is a two step process. The new owners must first be a co-teacher of the course. However if you are adding a new owner to a course that has been archived and/or a user suspended, then you need a few more commands.

Get Course ID

Find course and make note of Course ID.

gam print courses todrive

Reinstate Course if archived

gam update course <Course ID> coursestate active

Add Teacher

gam course <Course ID or alias> add teacher <New Teacher Email Address>

Make Owner

gam update course <Course ID or alias> owner <New Teacher Email Address>

Remove old owner

gam course <Course ID> delete teachers <Old Owner Email>

If needed the old owner may need their account un-suspended then re-suspended.

gam update user <Old Owner Email> suspended [off|on]

Reports

Posts Created for an OU

gam report users parameters classroom:num_posts_created orgunit "</Path/To/OU>range -8d -2d todrive

Last Interaction

This reports on the OU and sub-OU.

gam report user ou </Path/To/OU> parameters classroom:timestamp_last_interaction todrive

For only students. This will default to the last know day of data (generally -2d). Optionally you specify a range (e.g. range -9d -2d).

gam config csv_output_row_filter "'\"classroom:role\":regex:student'" redirect csv UserClassroomInteraction.csv report user parameters classroom:timestamp_last_interaction,classroom:role

This will create a CSV file called UserClassroomInteraction.csv in the default folder. Alternatively, you can add todrive to the end of the command to output the file to Google Drive as well as the CSV.

Active Classrooms and Number of Posts/Assignements

Create a CSV (teachers.csv) with the email of teachers you need to check and use in these commands. Analyse the courses.csv & coursework.csv for the info.

gam redirect csv courses.csv multiprocess csv teachers.csv gam print courses teacher "~teacher"

gam redirect csv coursework.csv multiprocess csv teachers.csv gam print course-work teacher "~teacher"

Create a Classroom course

This process can be used to create a Classroom Course on a remote account. For example creating a course in a Student account.

Create Course

gam create course alias <"Course Name"> teacher <User Email Address> name <"Course Name">

After running this command the output will show the Course ID. You will need this ID for other GAM commands.

Course Name: Course Name, Course: Course-ID, Created

Make the course active

This is needed otherwise anyone added to this course will not see it in their Classroom. You will need to get the Course ID from the output of the above command.

gam update course <Course ID> status ACTIVE

Add teacher

gam course <Course ID> add teacher <User Email Address>

Add a teacher to all courses

gam print courses | gam csv - gam course ~id add teacher <User Email Address>

Get Course info, eg Enrolment Code

gam info course <Course ID>

Delete

A Teacher/Student

gam course <CourseID> delete|remove teachers|students <User Email Address>

Delete a course

gam delete course <Course ID>

gam csv gsheet <Owner Email> <File ID> <Sheet Name> gam delete course ~id

Update Course

Archive

gam update course <Course ID> state archived

gam csv gsheet <Owner Email Address> <File ID> <Sheet Name> gam update course ~id state archived

Name

gam update course <Course ID> name <New Name>

Owner

gam update course <Course ID> owner <New Owner Email Address> 

State

Unarchive a Classroom Course

gam update course <CourseID> state active