Update your Bookmarks to https://sites.google.com/view/gam--commands/home
The classroomprofile gives basic info about users access to Google Classroom.
gam user <User Email Address> print classroomprofile todrive
This can show the verified teachers and those with permission to create classrooms.
gam ou_and_children_ns </Path/To/OU> print classroomprofile todrive
gam redirect csv ./OldArchivedCourses.csv print courses states archived timefilter creationtime end yyyy-mm-dd todrive
gam print courses teacher <User Email Address> todrive
gam print courses teacher <User Email Address> fields name,id
gam print courses student <User Email Address> todrive
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
Print off all the owner emails (and ownerID) for all the classes.
gam print courses todrive fields owneremail
For a specific Course
gam print courses course <CourseID> fields owneremail
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
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
gam config csv_output_row_filter "ownerEmail:regex:'Unknown user'" redirect csv ./OrphanCourses.csv print courses fields name,owneremail
Where <Course ID> is the 'Classroom ID'
gam print course-announcements course <Course ID>
gam print course-participants course <Course ID> todrive
gam print course-participants course <Course ID> show teachers todrive
Change the date range as required.
gam print course-submissions fields courseid,courseworkid,id,state,creationtime,userid start -1d end -0d todrive
gam print course-submissions course <Course ID> fields courseid,courseworkid,id,state,creationtime,userid start -1d end -0d todrive
gam print course-work student <Student Email Address> showtopicnames fields title,topicid todrive
The classroomprofile gives basic info about users access to Google Classroom.
gam user <User Email Address> show classroomprofile
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.
gam courses <Course ID> sync teachers group <Group Email Address>
gam courses <Course ID> sync teachers ou "</Path/To/OU>"
gam show classroominvitations course <Course ID>
gam print classroominvitations course <Course ID> todrive
gam user <User Email Address> show classroominvitations
gam user <User Email Address> delete classroominvitation ids <Invitation ID>
gam print guardians invitations ou_and_children </Path/To/OU> todrive
gam user <Student Email Address> add guardian <Guardian Email Address>
gam user <Student Email Address> delete guardian <Guardian Email Address>
gam user <Student Email Address> show guardian invitations
gam user <Student Email Address> show guardian invitations state [pending | complete]
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
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
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 active and provisioned Classrooms.
gam print courses state active,provisioned owneremail todrive
Get the users of an OU
gam ou <Path/To/OU> print users fields primaryEmail > list_of_users.csv
gam csv list_of_users.csv gam course ~id add [student | teacher] ~primaryEmail
gam csv gsheet <User Email Address> <Google Sheet ID> <Sheet (Tab) Name> gam course ~id add teacher <New Teacher Email>
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.
Find course and make note of Course ID.
gam print courses todrive
gam update course <Course ID> coursestate active
gam course <Course ID or alias> add teacher <New Teacher Email Address>
gam update course <Course ID or alias> owner <New Teacher Email Address>
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]
gam report users parameters classroom:num_posts_created orgunit "</Path/To/OU>" range -8d -2d todrive
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.
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"
This process can be used to create a Classroom Course on a remote account. For example creating a course in a Student account.
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
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
gam course <Course ID> add teacher <User Email Address>
gam print courses | gam csv - gam course ~id add teacher <User Email Address>
gam info course <Course ID>
gam course <CourseID> delete|remove teachers|students <User Email Address>
gam delete course <Course ID>
gam csv gsheet <Owner Email> <File ID> <Sheet Name> gam delete course ~id
gam update course <Course ID> state archived
gam csv gsheet <Owner Email Address> <File ID> <Sheet Name> gam update course ~id state archived
gam update course <Course ID> name <New Name>
gam update course <Course ID> owner <New Owner Email Address>
Unarchive a Classroom Course
gam update course <CourseID> state active