Created
September 27, 2022 14:57
-
-
Save chris-bradbury/9194ccc50fd4fe6c99cc0a5eac3c2190 to your computer and use it in GitHub Desktop.
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