Microsoft Teams and PowerShell


The PowerShell Module allows the IT professional to control Microsoft Teams by automating the creation of teams, channels, and settings within a team.  Automating, simplifying, and streamlining daily tasks contributes to the success of Microsoft Teams within an organization. 

Installing the Module from the PowerShell Gallery

1.  As an Administrator, type PowerShell in the start menu. Right-click Windows PowerShell, then select Run as Administrator.  Click Yes at the UAC prompt.

PowerShell

2.  Type the following within PowerShell and then press Enter:

     Install-Module MicrosoftTeams

Teams PowerShell

3.  Type Y at the prompt.  Press Enter

Teams PowerShell

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

Once installed, you can now connect to Microsoft Teams.

Connecting to Microsoft Teams

1. Type the following and press Enter:

Connect-MicrosoftTeams

2.  The Microsoft Teams PowerShell Cmdlets dialog box will now appear.  Type in your Office 365 credentials. When done, press Enter.

3.  The following will display once you are connected to the Microsoft Teams instant in your Office 365 tenant:

With these steps completed, you can now begin to run cmdlets, or scripts, against Microsoft Teams. 

TIP:  To see a full list of commands that are available, type Get-Command-Module MicrosoftTeams

In the following table, currently available commands in PowerShell are described below along with a brief description of what that command performs:

Command

Description

Add-TeamUser

Adds an owner or member to the Team

Connect-MicrosoftTeams

Connect to the Microsoft Team based on the provided credentials

Disconnect-MicrosoftTeams

Disconnect from the Microsoft Team

Get-Team

Returns all the teams that the user belongs to

Get-TeamChannel

Returns all the channels for a Team

Get-TeamFunSettings

Returns a Team’s fun settings

Get-TeamGuestSettings

Returns Team guest settings

Get-TeamHelp

Returns a list of commands for Microsoft Teams

Get-TeamMemberSettings

Returns Team member settings

Get-TeamMessagingSettings

Returns Team messaging settings

Get-TeamUser

Returns all users from the Team

New-Team

Creates a new Team

New-TeamChannel

Add a new channel to the Team

Remove-Team

Deletes a Team

Remove-TeamChannel

Deletes a channel and this will not delete the content from associated tabs

Remove-TeamUser

Remove an owner or member from the Team

Last owner cannot be removed from the Team

Set-Team

Updates Team properties

Set-TeamChannel

Updates Team channel settings

Set-TeamFunSettings

Update GIPHY, Stickers and Memes settings

Set-TeamGuestSettings

Updates Team guest settings

Set-TeamMemberSettings

Updates Team member settings

Set-TeamMessagingSettings

Updates Team messaging settings

Set-TeamPicture

Updates the Team picture

It is important to remember that Teams use the same ID as the Office 365 Groups they are a part of and when creating a Team, a group is automatically created. However, an Office 365 Group does not, by default, create a Team. 

Microsoft Teams and PowerShell provides tools for the IT professional resulting in simpler administration with the flexibility to customize controls accessible to the end-user, control over current and future governance of Microsoft Teams, and creative possibilities of standardizing Team settings, creating a self-service tool on the back-end for end-users to create Teams but with controls for IT and creating a *.csv file when creating large teams and/or adding numerous members to an existing Team.

Microsoft Teams and PowerShell combine to provide a rich and powerful tool for the IT professional. 

  • Sunday, January 07, 2018 By : Mike Maadarani    0 comment