Microsoft Teams: PowerShell Support

As an IT Professional, I am always looking for ways to automate tasks and make daily operations simple. When it comes to Microsoft Teams, being able to automate the creation of teams, channels, and settings within a team is critical to the success of Microsoft Teams within an organization. PowerShell support for Microsoft Teams allows you to do exactly that, and it gives me additional ideas to make the administration of Teams easier:

  • Automatically provision new teams, new channels within the team, add members and set options such as a picture, and member permissions.
  • Create a self-service tool that uses PowerShell on the back-end to make creating teams easy for end-users but with controls for IT. For example, a user browses to a website form to create a team. PowerShell can check for a team that has a duplicate name, to ensure users aren't creating teams with the same name. I see this as one simple example but is powerful when we start to think about governance we can provide to the business on Microsoft Teams.
  • If I need to add a large number of members to a team, using PowerShell I can add those members in bulk from a .csv
  • Standardize settings within each team that is created.
  • What's your idea for using PowerShell with Microsoft Teams? (Tell me in the comments below!)

UPDATE 12/28/2017: Documentation on GitHub

In this blog I will take you through how to download, install and run the a few examples in the Microsoft Teams PowerShell module. At the time of this writing, the following cmdlets are available:

Install-Module MicrosoftTeams

At the prompt type Y and press Enter:

If you are prompted for untrusted repository, type A (for Yes to All) and press Enter. The module will install.

Once installed, we can now connect to Microsoft Teams. To connect type the following and press Enter:



At the Microsoft Teams PowerShell Cmdlets dialog box, type your Office 365 credentials and press Enter

Once connected to the Microsoft Teams instance in your Office 365 tenant, the following will be displayed:

You can now start to run cmdlets, or scripts against Microsoft Teams! Note, at any time you can type Get-Command -Module MicrosoftTeams to see a full list of commands available:

To return a list of the teams in the environment, type the following and press Enter:


 Note: Within PowerShell, teams are referenced as a GroupID for the underlying Office 365 Group.

For the next example, let's create a new team for marketing employees in San Diego that is a private team. Type the following command and press Enter:

New-Team -DisplayName "San Diego Marketing" -AccessType Private

 The team will be created with an Office 365 GroupID assigned:

Note: The GroupID is important when you wish to assign classification policies to the underlying Office 365 group, in addition to when you need to remove the team among other things.

Within the Microsoft Teams client ( we can see the team has been created:

To remove the team, type the following and press Enter. Where <GroupID> is the GroupID of the team you created:

Remove-Team -GroupID <GroupID>

Conclusion: These are some of the basic functions you can perform with the Microsoft Teams PowerShell Module. Over time I'll be adding additional scenarios with PowerShell – if there's one you are interested in leave me a comment and I would be happy to write about it! 

Comments (13)

Cancel reply

  1. An-kun says:

    Wonderful. Simply wonderful. Thanks alot for this.

  2. BEAUDOIN says:

    Hi Matt, I’m pleased to see these modules for Teams. I’m admin of my tenant, I’m able to create a Teams without issues, but when I try the commande Get-Teams I got :
    Get-Team : Error occurred while executing
    Code: GeneralException
    Message: Failed to parse MS Graph backend response for request GetUserGroupsRequest. Request Url:$/$filter=groupTypes/any(c:c+eq+'Unified‘)&$top=999,
    Request Method: GET. The response is invalid, cannot convert to type IList`1Error converting value {null} to type
    ‘System.DateTime’. Path ‘value[0].renewedDateTime’, line 1, position 1871.
    RequestId: 77d68078-f5dd-482e-8c8f-d97065891fb6
    DateTimeStamp: 2017-11-08T10:48:49
    HttpStatusCode: GeneralException
    Au caractère Ligne:1 : 1
    + Get-Team
    + ~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Get-Team], ApiException
    + FullyQualifiedErrorId : Microsoft.TeamsCmdlets.PowerShell.Custom.ErrorHandling.ApiException,Microsoft.TeamsCmdle

    Any ideas ?


  3. Thanks for publishing this! I was waiting for this so I can start creating TEAMS programmatically. I would like to go a little bit further and have the ability using powershell of removing the Wiki link on the TAB and adding custom Web ones. Could I accomplish that today?

  4. Jonas Björkander says:

    I have problem with the get-team command also. All I get is the result of 1 (one) team – but I have alot of them provisioned already (most of them are upgraded from o365 groups but there are more than one provisioned from within the teams client). No errors, just one result.

  5. Cecilie says:

    Hi, would it be possible to use these cmdlets to create some functionality for archiving channels and chats do you think? While we’re waiting for Microsoft to provide the functionality 🙂

  6. Giuseppe says:

    Hi Matt, can be possible to add function to manage the Tabs ?

  7. Thomas Glaser says:

    > “Note, at any time you can type Get-Command -Module MicrosoftTeams to see a full list of commands available”

    Seems that Get-TeamHelp does exactly that. Pointless function IMO, but it’s there and might be easier to remember for some people.

    1. Matt Soseman says:

      Yes, you are correct, that is an alternative way.

  8. Coleman says:

    Hi I am so thrilled I found your web site, I really found you by mistake, while I was searching on Aol for something else, Anyhow I am here now and would just like to say thank you for a tremendous post and a all round exciting blog (I also love the theme/design), I donít have time to read through it all at the moment but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read more, Please do keep up the excellent work.

  9. Claudia says:

    Nice post! So helpful 🙂

    When it comes to use the command “Get-Teams” it only shows the Teams you are a member of, right? If you have a Global Admin role, is there way (or could it be a way in a future version) that you could list all the created Teams in the tenant? That way, as admins we could check how many Teams we have.

    Thanks a lot!

  10. Vish86 says:


    Good article … When we create a team with powershell, why it does not trigger a email to members? Members do get email notification when teams are created manually.


  11. Bjorn says:

    Any plans for a cmdlet to get/set the Channels a User has favorited or followed? An essential part of Teams adoption is getting Users into conversations via the appropriate favorited Channels. Ideally we could set favorite Channels for Users to get them going. The ‘first 5’ Channel favorite feature is arbitrary and creates unnecessary admin work.

Skip to main content