question

NK-8552 avatar image
0 Votes"
NK-8552 asked SharonZhao-MSFT commented

Create 800+ Teams using a newly customized template with powershell & CSV file as data input.

In Teams, I've created a customized template for my org, I wan to create 800+ teams with that template using PowerShell & a CSV file to get data inputs like teams names, descriptions, type, etc. for each of the team. It should create everything like groups, SharePoint site, email ID, etc. by default as you would create using UI. Any help in this regards would be greatly appreciated. Please share PowerShell code/script and/or parameters to pass on to achieve it. Thanks!

office-teams-windows-itprooffice-teams-app-devmicrosoft-graph-teamwork
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SharonZhao-MSFT avatar image
0 Votes"
SharonZhao-MSFT answered SharonZhao-MSFT commented

@NK-8552,

Satyajit Paul provides a script which should be executed in a Windows machine, with the Teams creation instructions being read from an csv file.

Above all, create a csv file including the details for teams, such as Team name, Team description, Visibility and owner of the team.

Then, refer to the following script:

 #Connnect to Microsoft Teams
 $connection = Connect-MicrosoftTeams
 try
 {
     #CSV File Path. Change this location accordingly
     $filePath = "C:\Users\Satya\Desktop\CreateBulkTeams.csv"
    
     #read the input file
     $loadFile = Import-Csv -Path $filePath 
    
     foreach ($row in $loadFile)
     {
         $teamName = $row.'Team name'
         $teamDescription = $row.'Team description'
         $teamOwner = $row.Owner
         $teamVisibility = $row.Visibility
    
         #create the team with specified parameters
         $groupID = New-Team -DisplayName $teamName -Owner $teamOwner -Description $teamDescription -Visibility $teamVisibility
         Write-Host "Team " $teamName " created successfully..."
     }  
    
     Write-Host $loadFile.Count " teams were created" -ForegroundColor Green -BackgroundColor Black 
 }
    
 catch
 {
       Write-Host "An error occurred:"
       Write-Host $_
 }

For more details, please refer to this article.

Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 9
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


@SharonZhao-MSFT :- Thank you for the script. I just have one question, how can I get that customized template used? Is there a way to get a unique ID for that specific template which can some how passed into above script to force the script when it creates new team is should use that specific template only? For example, Lets say I just want to use -template "EDU_CLASS" in education tenant? or any customized template I create using existing team.

please suggest on this.

0 Votes 0 ·

@NK-8552,

how can I get that customized template used?

You could run Get-CsTeamTemplateList cmdlet to get your custom template. This cmdlet supports to retrieve information of all team templates available to your tenant, including custom templates.

I just want to use -template "EDU_CLASS" in education tenant? or any customized template I create using existing team.

According to the official document, using New-Team cmdlet to create a new team using a template is still in preview. You can install and use the preview module from the PowerShell test gallery.


0 Votes 0 ·

@NK-8552,
As we are mainly responsible for general question of Microsoft Teams, script is not supported by us. I will add office-teams-app-dev tag to get more help. Thanks for your understanding.

0 Votes 0 ·

@NK-8552,
Do you have any further question on this topic now?

0 Votes 0 ·

I'm yet to try it out. Its planned this weekend. I'll be able to update more by then. Thank you @SharonZhao-MSFT for follow up! THANKS!!

0 Votes 0 ·
Show more comments
KartheekRaparthy-6860 avatar image
0 Votes"
KartheekRaparthy-6860 answered NK-8552 commented

keep all your inputs in csv file - teamName , teamOwner, teamDescription, teamVisibility in csv file.


Connnect to Microsoft Teams

$connection = Connect-MicrosoftTeams
try
{
#CSV File Path. Change this location accordingly
$filePath = "Teams.csv"

  #read the input file
  $loadFile = Import-Csv -Path $filePath 
    
  foreach ($row in $loadFile)
  {
      $teamName = $row.'Team name'
      $teamDescription = $row.'Team description'
      $teamOwner = $row.Owner
      $teamVisibility = $row.Visibility
    
      #create the team with specified parameters
      $groupID = New-Team -DisplayName $teamName -Owner $teamOwner -Description $teamDescription -Visibility $teamVisibility
      Write-Host "Team " $teamName " created successfully..."
  }  
    
  Write-Host $loadFile.Count " teams were created" -ForegroundColor Green -BackgroundColor Black 

}

catch
{
Write-Host "An error occurred:"
Write-Host $_
}


below cmdlets provide the details. Get-CsTeamTemplateList, Get-CsTeamTemplate, New-CsTeamTemplate


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you @KartheekRaparthy-6860 - I'll test out and get back to you if there are further issues.

0 Votes 0 ·