Created
September 27, 2022 14:57
Powershell Function to add a teacher as a co-teacher to all Google Classrooms of a given student. Function accepts piped objects with $SamAccountName parameter as the student.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Add-ClassroomTeacherToStudentsClasses { | |
[CmdletBinding()] | |
Param( | |
[string] | |
$Student,$Teacher, | |
[Parameter(ValueFromPipelineByPropertyName)] | |
$SamAccountName | |
) | |
$gamExeLocation = "\path\to\gam.exe" | |
##-- if no SamAccountName object was piped --## | |
if($null -eq $SamAccountName){ | |
$SamAccountName = $student | |
} | |
. $gamExeLocation print courses student $SamAccountName state active | . $gamExeLocation csv - gam course ~id add teacher $Teacher | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment