Microsoft TeamsPowershell

How To Create Teams & Channels Using CSV And Powershell

Here is another Tutorial I will show you how to Create Teams & Channels using CSV and Powershell. Often office365 Admins will receive the list to create hundreds of teams and channels for school, collages, or for small companies. Making all those Teams and Channels by hand will take ages to complete the task, but with the power of Powershell scripting, we can do this in minutes

Install Microsoft Teams Powershell Module

First, we need to install the Microsoft Teams module for Powershell by running the following command.

Install-Module -Name MicrosoftTeams

Once the installation of the module is complete, its always good practice to check what commands are available to us for the module we just installed by running the following command.

Get-Command -Module MicrosoftTeams
Get-Command -Module MicrosoftTeams

Creating CSV File For Importing Data

Now we are almost ready to start scripting the bulk creation of Microsoft Teams and Channels. The last thing we need is data in the CSV file. I have created the CSV file with the necessary fields, and you can copy the same data for you as well. If you make to make some adjustments to CSV fields, you can do that because I will explain the code to you so you can customize your CSV file and Powershell script for creating bulk Teams and Channels.

Recommended For You:  How to Perform a Bulk User Password Reset in Office 365 with PowerShell

Here is my CSV File with Fields necessary to create Teams and Channels and temp data. You need to enter the actual data you received from your management.


Importing CSV File Data

Now everything is ready, so let’s start building our script. First, we need to import data from our saved CSV file to our Powershell variable called \$data by running the following command. Remember, you need to put your CSV path because your CSV path might be different than mine.

$data = Import-Csv C:\Scripts\bulkTeams.csv

Creating and Running The Script

Once the data is in the variable, we need to loop through data to create the Teams and Channels by running the following command.

If you don’t have much knowledge about Powershell below code might be hard fro you to digest but don’t worry its very easy. I will explain you few things which might help ou to understand the code.

foreach ($d in $data) {
    $GroupID = (New-Team -DisplayName $d.TeamDisplayName -Description  $d.TeamDescription`
-MailNickName $d.MailNickName -Visibility $d.TeamVisibility -Owner $d.Owner).GroupID

New-TeamChannel -GroupId $GroupID -DisplayName $d.ChannelDisplayName -Description $d.ChannelDescription


Basically, in the above code block, Foreach Loop is used, which reads every object in the array of objects. We are using Foreach Loop to read for us each line, and then we are using that data to create out Teams and channels.

Recommended For You:  Monitoring Virtual Machine Performance Metrics in Hyper-V Using PowerShell Commands

That’s all it’s so simple, and with the few lines of code, we can finish the works in a few seconds, which might take days without Powershell scripting.

Final Script

Here is the complete code you will need to Bulk Create the Microsoft Teams and Channels.

$data = Import-Csv C:\Scripts\bulkTeams.csv
foreach ($d in $data) {
    $GroupID = (New-Team -DisplayName $d.TeamDisplayName -Description  $d.TeamDescription`
-MailNickName $d.MailNickName -Visibility $d.TeamVisibility -Owner $d.Owner).GroupID

New-TeamChannel -GroupId $GroupID -DisplayName $d.ChannelDisplayName -Description $d.ChannelDescription




Muhammad Faizan

Hi, My name is Muhammad Faizan and i have spent last 15 years working as System Administrator mainly with Microsoft Technologies. I am MCSE, MCTP, MCITP, certified professional. I love scripting and Powershell is the scripting language i am in love with.

Related Articles


  1. Hello I am getting this error when running your script

    New-Team : Impossible to validate argument on parameter « DisplayName ». argument is Null or empty
    What is wrong?

  2. Hi,
    How to add multiple channels in a single team
    Ex: I have 5 Teams and I want to add 60 channels in each team.
    Please help

    1. You can do it easily.

      Just createForEach loop for New-TeamChannel command the same way he created the loop for Teams. I will be nested Foreach loop.

  3. Hi there,

    This is really great and a help for me. Just a couple of questions:

    1) Were you able to tweak it so that it could add in users to the Teams channels?
    2) How would you edit the script/CSV to create multiple channels in a Teams area?


      1. Thanks Muhammad – I am keen to see this script. I have 960 participants in a global event that I need to speedily put into 120 channels the day before the event begins. Is that what your script would help me to speedily achieve. And if so, can you point me in the direction to find your work please? Regards, Deb

        1. Hi,

          Yes, you can do that very easily with my script and If you explain exactly what you need may be i will edit the script as per your need.

          It’s always better you learn the code by yourself and ask here if you need any help.

  4. Is there an option to import a distribution list to each team?
    Its the only thing missing on my team creating script.


  5. it would also be good to mention about -Template options too for those in an educational environment where they will need the EDU_Class option to be applied.

  6. This is amazing and so simple, i’m happy with not adding users as we get our teachers to do this, great work !

    i really must learn powershell.

    1. Ok, i will add that as well in the script. I have done this already for my personal use so it’s just going to take copy/paste. If you need any other help related to Powershell feel free to fill the Contact Us form and i always reply those who contact me. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Back to top button