How to use PowerShell to create a lot of Teams in Microsoft Teams?

Bram Tanis 1 Reputation point
2021-05-06T13:22:39.903+00:00

Dear Microsoft employee,

I am consultant for Schouten & Nelissen regarding Microsoft Teams. These days we have a lot of work in creating all these different Teams. My question is whether it's possible to do this a lot quicker through the use of PowerShell. Could you help me any further?

With kind regards,

Bram Tanis

Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,295 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Vasil Michev 106.6K Reputation points MVP
    2021-05-06T17:41:47.273+00:00

    Define "a lot quicker"? :) You can certainly use the Teams PowerShell module and the New-Team cmdlet, but you're probably better off using the Graph API directly, and utilizing the templates functionality as well: https://learn.microsoft.com/en-us/microsoftteams/get-started-with-teams-templates

    0 comments No comments

  2. Sharon Zhao-MSFT 25,101 Reputation points Microsoft Vendor
    2021-05-07T02:22:44.957+00:00

    @Bram Tanis ,

    As we are mainly responsible for general question of Microsoft Teams, your question related to scripts is not supported by us. I will add office-teams-windows-itpro tag. Thanks for your understanding.

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.