First version of Microsoft Teams PowerShell module is now available

Today, the good folks at Microsoft released (an early preview version of) the Teams PowerShell module. The version is dubbed 0.9.0, and again, is a Preview one. The module has been one of the common asks from Office 365 admins, as PowerShell is the tool of choice when it comes to automation.

Do not get overexcited though, this is an initial release, not even in GA status. There are not many cmdlets available (23 to be precise) and lots of issues. Still, if you want to give it a try, you can download the module from the PowerShell Gallery here: https://www.powershellgallery.com/packages/MicrosoftTeams/

Here’s the full list of cmdlets:

[20:03:22][O365]# Get-Command -Module MicrosoftTeams

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Add-TeamUser                                       0.9.0      MicrosoftTeams
Cmdlet          Connect-MicrosoftTeams                             0.9.0      MicrosoftTeams
Cmdlet          Disconnect-MicrosoftTeams                          0.9.0      MicrosoftTeams
Cmdlet          Get-Team                                           0.9.0      MicrosoftTeams
Cmdlet          Get-TeamChannel                                    0.9.0      MicrosoftTeams
Cmdlet          Get-TeamFunSettings                                0.9.0      MicrosoftTeams
Cmdlet          Get-TeamGuestSettings                              0.9.0      MicrosoftTeams
Cmdlet          Get-TeamHelp                                       0.9.0      MicrosoftTeams
Cmdlet          Get-TeamMemberSettings                             0.9.0      MicrosoftTeams
Cmdlet          Get-TeamMessagingSettings                          0.9.0      MicrosoftTeams
Cmdlet          Get-TeamUser                                       0.9.0      MicrosoftTeams
Cmdlet          New-Team                                           0.9.0      MicrosoftTeams
Cmdlet          New-TeamChannel                                    0.9.0      MicrosoftTeams
Cmdlet          Remove-Team                                        0.9.0      MicrosoftTeams
Cmdlet          Remove-TeamChannel                                 0.9.0      MicrosoftTeams
Cmdlet          Remove-TeamUser                                    0.9.0      MicrosoftTeams
Cmdlet          Set-Team                                           0.9.0      MicrosoftTeams
Cmdlet          Set-TeamChannel                                    0.9.0      MicrosoftTeams
Cmdlet          Set-TeamFunSettings                                0.9.0      MicrosoftTeams
Cmdlet          Set-TeamGuestSettings                              0.9.0      MicrosoftTeams
Cmdlet          Set-TeamMemberSettings                             0.9.0      MicrosoftTeams
Cmdlet          Set-TeamMessagingSettings                          0.9.0      MicrosoftTeams
Cmdlet          Set-TeamPicture                                    0.9.0      MicrosoftTeams

Unfortunately, many of the cmdlets don’t seem to work as expected, and the ones that do require you to use GUIDs in order to reference the TeamID, so the experience can definitely be improved. But hey, it’s a first step, and it does allow some cool stuff even in this crippled state.

For example, here’s how to view and change some of the Team settings.

[20:16:11][O365]# Get-TeamMemberSettings -GroupId c7442983-e654-40b1-a73b-fef16f6a88e6

AllowCreateUpdateChannels         : True
AllowDeleteChannels               : True
AllowAddRemoveApps                : True
AllowCreateUpdateRemoveTabs       : True
AllowCreateUpdateRemoveConnectors : True

In case you don’t want to type in GUIDs, this variation will do:

[20:16:17][O365]# Get-TeamMemberSettings -GroupId (Get-MsolGroup -SearchString TeamOne).ObjectId

AllowCreateUpdateChannels         : True
AllowDeleteChannels               : True
AllowAddRemoveApps                : True
AllowCreateUpdateRemoveTabs       : True
AllowCreateUpdateRemoveConnectors : True

To prevent users from adding or removing connectors, use:

[20:17:08][O365]# Set-TeamMemberSettings -GroupId (Get-MsolGroup -SearchString TeamOne).ObjectId -AllowCreateUpdateRemoveConnectors $false
[20:17:51][O365]# Get-TeamMemberSettings -GroupId (Get-MsolGroup -SearchString TeamOne).ObjectId

AllowCreateUpdateChannels         : True
AllowDeleteChannels               : True
AllowAddRemoveApps                : True
AllowCreateUpdateRemoveTabs       : True
AllowCreateUpdateRemoveConnectors : False

We can confirm that the changes are made via the UI as well:

Expect additional examples and more details as the module matures 🙂

2 thoughts on “First version of Microsoft Teams PowerShell module is now available

  1. Tanya Stawicki says:

    I have used the new “New-Team” & “Add-TeamUser” commands to bulk-create and fill some (school) teams. This works flawlessly. The teams appear immediately in the browser. There is one problem: In the browser the tab “Assignments” does not appear on the Team-page.

    What do I wrong? Anybody?

    =====code========
    $myteam = New-Team -DisplayName $teamname -Description $teamname -Alias $teamname -AccessType Private
    if ( $? ) {
    # creating team was successfull: now add members & owners
    Write-Host $(“Team ” + $teamname + ” : success”)-foregroundcolor Green
    Write-Host “sleeping before adding members……”
    sleep 10
    # add owners to the team
    foreach ( $o in $owners) {
    Add-TeamUser -GroupId $myteam.GroupId -User $o.UserPrincipalName -Role Owner
    }

    # add members to the team
    foreach ( $m in $members) {
    Add-TeamUser -GroupId $myteam.GroupId -User $m.UserPrincipalName -Role Member
    }
    }
    else {
    # creating team failed….
    Write-Host “error creating $teamname” -foregroundcolor Red
    }
    ====end code ==========

    Reply
    1. Vasil Michev says:

      Hey Tanya, the module (and the underlying API) is still in Preview, so issues are expected. In addition, with the Groups/Teams model, some operations are performed asynchronously, and it takes some time for the changes to be visible across all modalities.

      Reply

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.