Microsoft Teams PowerShell Module general availability

Microsoft-Teams

A little news about Microsoft Teams this time, the Version 1 of the Microsoft Teams PowerShell module has been released by the end of April 2019. This module is composed of 14 CmdLets that will allow you to control the Microsoft Teams lifecycle in your environment.

To install it you can follow this link to the PowerShell Gallery or type the following command inside a PowerShell session:

#To install the latest version of the Microsoft Teams PowerShell module
Install-Module -Name MicrosoftTeams

#If you want to install another version (to get the beta CmdLets for instance)
Install-Module -Name MicrosoftTeams -RequiredVersion 0.9.6

The Version 1 of the Microsoft Teams PowerShell module allow you to run the following CmdLets :

CmdletDescription
Connect-MicrosoftTeamsConnects to the Microsoft Teams environment
Disconnect-MicrosoftTeamsDisconnects from the Microsoft Teams environment
Get-TeamRetrieves teams
Get-TeamChannelGets all the channels for a team
Get-TeamHelpProvides a list of commands for Microsoft Teams
Get-TeamUserReturns the users of a specific team
New-TeamProvisions a new Team, or converts a group to a team
New-TeamChannelAdds a new channel to a team
Add-TeamUserAdds an owner or member to the team
Remove-TeamDeletes a team
Remove-TeamChannelDeletes a channel
Remove-TeamUserRemoves an owner or member from a team
Set-TeamUpdates properties of a team
Set-TeamChannelUpdates Team channel information

Note that we will still edit Policies and Configuration using the Skype for Business PowerShell module.

For simplicity and discoverability purpose, the following beta commands are not part of the version 1. Their functionalities are consolidated with Get-Team and Set-Team :

– Get-TeamFunSettings
– Get-TeamGuestSettings
– Get-TeamMemberSettings
– Get-TeamMessagingSettings
– Set-TeamFunSettings
– Set-TeamGuestSettings
– Set-TeamMemberSettings
– Set-TeamMessagingSettings

Here are some examples of what you can do with the Microsoft Teams PowerShell Module :

#Connect to the Teams Environment
Connect-MicrosoftTeams

#Retrieve Teams from the environment
Get-Team

#Create a Team
New-Team -DisplayName TestTeams -Visibility Private -Owner $owner #Email address

#Modify some settings
$MyTeam = Get-Team -DisplayName TestTeams
Set-Team -GroupId $MyTeam.GroupId -DisplayName 'WebSite Improvements'
New-TeamChannel -GroupId $MyTeam.GroupId -DisplayName 'Test'
Set-TeamChannel -GroupId $MyTeam.GroupId -CurrentDisplayName 'Test' -NewDisplayName 'Navigation UI/UX'

#Check if Private Teams have less than two Owners
$objAllPrivateTeams = Get-Team -Visibility Private
foreach ($team in $objAllPrivateTeams) {
    $teamOwner = Get-TeamUser -GroupId $team.GroupId -Role Owner
    if ($teamOwner.Count -lt 2) {Write-Host "$($team.DisplayName) does not match compliance"}
}

Finally, you can find bellow some helpful links in case you want further information about Microsoft Teams and PowerShell :
Microsoft Teams on GitHub
Microsoft Docs CmdLets Documentation
Microsoft Docs Teams PowerShell overview

See you soon in the blog !

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.