Microsoft Teams is a chat-based workspace for Office 365 – Microsoft

It is one of the emerging applications in Office 365, which helps to bring people to a single place for collaborating on content, conversations, connecting with people, and more…

We can handle Microsoft Teams through the web browser and client-based Microsoft Teams application. We also have Microsoft Graph API to manage Microsoft Teams by managing teams, channels, members, and more.

Microsoft Graph API makes the lives of developers easier, but for IT professionals, it is difficult to control the Teams application. To help them, Microsoft has come up with a PowerShell Module to control the Microsoft Teams.

To get the PowerShell Module to our local environment, we have to get the MicrosoftTeams module from PowerShell Gallery.

Find the MicrosoftTeams PowerShell module from the PowerShell Gallery

Install Microsoft Teams PowerShell module as an Administrator

Install Microsoft Teams PowerShell module as a normal user

PS:> Install-Module MicrosoftTeams –Scope CurrentUser

Verify the PowerShell module is installed

PS:> Get-Module MicrosoftTeams -ListAvailable

Get the list of available cmdlets from Microsoft Teams

After the installation of Microsoft Teams PowerShell module, we can get the list of available commands available in the module to manage and control the Microsoft Teams

Based on the screenshot above, below is the list of command and I have linked them to the documentation for each command

CommandDescription
Add-TeamUserAdds an owner or member to the Team
Connect-MicrosoftTeamsConnect to the Microsoft Team based on the provided credentials
Disconnect-MicrosoftTeamsDisconnect from the Microsoft Team
Get-TeamReturns all the teams that the user belongs to
Get-TeamChannelReturns all the channels for a Team
Get-TeamFunSettingsReturns a team's fun settings
Get-TeamGuestSettingsReturns Team guest settings
Get-TeamHelpReturns a list of commands for Microsoft Teams
Get-TeamMemberSettingsReturns team member settings
Get-TeamMessagingSettingsReturns team messaging settings
Get-TeamUserReturns all users from the team
New-TeamCreates a new team
New-TeamChannelAdd a new channel to the team
Remove-TeamDeletes a Team
Remove-TeamChannelDeletes a channel and this will not delete the content from associated tabs
Remove-TeamUserRemove an owner or member from the team. The last owner cannot be removed from the team
Set-TeamUpdates a team properties
Set-TeamChannelUpdates a team channel settings
Set-TeamFunSettingsUpdate Giphy, Stickers and Memes settings
Set-TeamGuestSettingsUpdates team guest settings
Set-TeamMemberSettingsUpdates team member settings
Set-TeamMessagingSettingsUpdates team messaging settings
Set-TeamPictureUpdates the team picture

Connect Microsoft Team

To get the Teams available for the current user

PS:> $cred = Get-Credential
PS:> Connect-MicrosoftTeams –Credential $cred
PS:> Get-Team

PowerShell

To create a new Team

Below is the syntax used for creating a new team,

New-Team -DisplayName <String> [-Description <String>] [-Alias <String>] [-Classification <String>] [-Visibility <String>] [-DontAddMeAsMember <Boolean>]

PropertyMandatory
DisplayNameYes
DescriptionNo
AliasNo
ClassificationNo
VisibilityNo
DontAddMeAsMemberNo

Use the below steps to create a new Team,

PS:> $cred = Get-Credential
PS:> Connect-MicrosoftTeams –Credential $cred
PS:> New-Team –DisplayName <NewTeamName>

PowerShell

Update settings to the Team

Below is the syntax for updating the property to the Microsoft Team,

Set-Team -GroupId <String> [-DisplayName <String>] [-Description <String>] [-Alias <String>] [-Classification <String>] [-AccessType <String>]

PropertyMandatory
GroupIdYes
DisplayNameNo
DescriptionNo
AliasNo
ClassificationNo
AccessType [Public | Private]No

The following step used to change the display name for the Team,

PS:> $cred = Get-Credential
PS:> Connect-MicrosoftTeams –Credential $cred
PS:> Set-Team –GroupId <Team’s Group Id> –DisplayName <NewTeamName>

PowerShell

Delete a Team

Now, we are going to delete the team “PowerShellTeam” from the Microsoft Teams & Office 365.

Below is the syntax to remove the team from the Microsoft teams

Remove-Team -GroupId <String>

PS:> $cred = Get-Credential
PS:> Connect-MicrosoftTeams –Credential $cred
PS:> Remove-Team -GroupId <Team’s Group Id>

PowerShell

Summary

The PowerShell module for Microsoft Teams is in the initial stage and currently, it contains the basic commands to do basic options. Lot more commands are yet to come, so keep your eye on the documentation for each command which are available on GitHub. I’ll bring out the details of other commands in my next article. So stay tuned…