Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
powershell-scripts/Create_PT_Teams.ps1
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
30 lines (29 sloc)
1.21 KB
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
# You need to have the Teams pwoershell module installed first. To do this run | |
# Install-Module -Name MicrosoftTeams -Scope CurrentUser | |
# in a powershell prompt | |
# You'll also need to run | |
# Connect-MicrosoftTeams | |
# at the command prompt before running the script | |
$teams_csv="C:\Users\ac9207\OneDrive - Coventry University\Workbench\PowerShell\Master-groups.csv" | |
$students_csv="C:\Users\ac9207\OneDrive - Coventry University\Workbench\PowerShell\Master-students.csv" | |
$faye="ac9207@coventry.ac.uk" | |
$farzana="aa4015@coventry.ac.uk" | |
Import-Csv -Path $teams_csv | foreach { | |
$gn=$_.Group_Name | |
$staff=$_.Email | |
Write-Output $gn | |
Write-Output $staff | |
Write-Output $farzana | |
$group = New-Team -displayname $gn | |
$gid= $group.GroupId | |
Write-Output $gid | |
#Start-Sleep -s 20 | |
#Add-TeamUser -Verbose -GroupId $group -User $faye -Role Owner | |
Add-TeamUser -Verbose -GroupId $gid -User $farzana -Role Owner | |
Add-TeamUser -Verbose -GroupId $gid -User $staff -Role Owner | |
Import-Csv -Path $students_csv | foreach { | |
$ngn=$_.PT_Teams_site | |
$student=$_.Email | |
if ($gn -eq $ngn) {Add-TeamUser -Verbose -GroupId $gid -User $student} | |
} | |
} |