Skip to content

Instantly share code, notes, and snippets.

View chris-bradbury's full-sized avatar

chrisbradbury chris-bradbury

View GitHub Profile
@chris-bradbury
chris-bradbury / Add-ClassroomTeacherToStudentsClasses.ps1
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.
function Add-ClassroomTeacherToStudentsClasses {
[CmdletBinding()]
Param(
[string]
$Student,$Teacher,
[Parameter(ValueFromPipelineByPropertyName)]
$SamAccountName
)
$gamExeLocation = "\path\to\gam.exe"
##-- Import Posh-ACME Module --##
Import-Module -Name Posh-ACME
##-- set the server. LE_STAGE or LE_PROD --##
Set-PAServer LE_PROD
##-- set up letsencrypt acount if it doesn't already exist --##
If(!(Get-PAAccount)){
New-PAAccount -AcceptTOS -Contact "<--email address for contact-->"
}
@chris-bradbury
chris-bradbury / RoboDelete.ps1
Created August 2, 2022 12:00
A quick powershell function to use Robocopy to delete a full directory.
function RoboDelete{
param (
$Path
)
##-- generate a randomly named folder --##
$randomString = -join ((48..57) + (97..122) | Get-Random -Count 32 | % {[char]$_})
##-- make the empty directory --##
New-Item -ItemType Directory -Path $randomString -Verbose