Jump to content

Recommended Posts

Posted

Staff member wants a team with just female pupils - Easy to get CSV from MIS but cant see to find an easy way to bulk add them to a MS Group\Team from CSV.

Can this be done?

Posted
Very easy to do if you have the GUID of the team and powershell, or if they are in a AD Synchronised group you should be able to add them to the Team that was as well.
  • Thanks 1
Posted

<#

.SYNOPSIS

Add Students to Team Classes

.DESCRIPTION

This script will add students to Teams Classes from CSV spreadsheet.

.NOTES

Author: xxxxxxxxxxxxxxxxxx

Version: 1.0

Creation Date: 07/04/2020

Purpose/Change: Initial script development

Edited for now

#>

 

# Connect to Teams

Connect-MicrosoftTeams

 

# Add students to Teams Classes

$members = Import-Csv -Path "C:\temp\examplecsv.csv"

foreach ($member in $members) {

$membersInTeam = Get-TeamUser -GroupId $member.GroupId -Role Owner | Select-Object -ExpandProperty User

if ($membersInTeam -contains $member.userPrincipalName) {

Write-Host -Object "$($member.userPrincipalName) is already in Team Class $($member.GroupId)" -ForegroundColor Yellow

} else {

Add-TeamUser -GroupId $member.GroupId -Role Owner -User $member.userPrincipalName

Write-Host -Object "$($member.userPrincipalName) have been added to Team Class $($member.GroupId)" -ForegroundColor Green

}

}

# Disconnect from Teams

Disconnect-MicrosoftTeams

 

csv.png

Posted
<#

.SYNOPSIS

Add Students to Team Classes

.DESCRIPTION

This script will add students to Teams Classes from CSV spreadsheet.

.NOTES

Author: xxxxxxxxxxxxxxxxxx

Version: 1.0

Creation Date: 07/04/2020

Purpose/Change: Initial script development

Edited for now

#>

 

# Connect to Teams

Connect-MicrosoftTeams

 

# Add students to Teams Classes

$members = Import-Csv -Path "C:\temp\examplecsv.csv"

foreach ($member in $members) {

$membersInTeam = Get-TeamUser -GroupId $member.GroupId -Role Owner | Select-Object -ExpandProperty User

if ($membersInTeam -contains $member.userPrincipalName) {

Write-Host -Object "$($member.userPrincipalName) is already in Team Class $($member.GroupId)" -ForegroundColor Yellow

} else {

Add-TeamUser -GroupId $member.GroupId -Role Owner -User $member.userPrincipalName

Write-Host -Object "$($member.userPrincipalName) have been added to Team Class $($member.GroupId)" -ForegroundColor Green

}

}

# Disconnect from Teams

Disconnect-MicrosoftTeams

 

[ATTACH=CONFIG]65021[/ATTACH]

 

Obviously you would not be adding students in with the -role Owner but -role Member

Only the Teachers should be an Owner

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...