On March 14th 2017 in New York, Microsoft has announced that MS Teams will be released worldwide. Not sure if at this time it was clear, what MS Teams would become until today (and in the future).
Today, every day more and more people are joining Teams. The thing that was missing was a useful PowerShell Module. The first PowerShell module for Teams appeared in March 2017 as well. However, it was not that useful in the beta version.
That PowerShell module (V 0.9) had 24 cmdlets available. Later, they came out with other versions like V 0.9.6, which was the latest version since November 2018 until now.
On April 24th, Microsoft now finally released a new Version (V 1.0.0) of the Teams PowerShell Module.
Note: You can find all versions of the module in the PowerShell Gallery, following this Link: https://www.powershellgallery.com/packages/MicrosoftTeams/1.0.0
Install new PowerShell Module
Depending, if we have already installed an older version of the PowerShell module of Teams or not, we have different starting points.
If we have already installed an older version, we need to remove it first. We can perform this action by using the command below:
Uninstall-Module MicrosoftTeams
Now, we are ready to install the latest Version of the Module. To do so, we run the command:
Install-Module MicrosoftTeams –Repository PSGallery
Note: If you want to install an older version of the Module, you need to run the command with the parameter -RequiredVersion. Here’s the example for installing version 0.9.6:
Install-Module –Name MicrosoftTeams –RequiredVersion 0.9.6
However, I don’t recommend to do that if not absolutely necessary. For a regular use-case, we should install the latest version.
After we have installed the new module, we need to connect to our environment. We do this by running the following command:
Connect-MicrosoftTeams
Now, we get the well-known Microsoft Sign-in dialog:
After entering the correct credentials, we are now connected to our Teams environment:
Trust is good, control is better! To make sure that we really installed the latest version of the Module, we can run the command below:
Get-Module |?{$_.Name -eq "MicrosoftTeams"}|Select Name, Version
As we can see in the output, we now have the latest version of the Teams PowerShell Module installed.
Note: After installing the new Module, we may need to update some, or all of our PowerShell scripts for MS Teams, which we created in the past.
What is new?
With the new module, we are now able to use the PowerShell module also for users with an Office365 “Teams-Administrator” role permission.
The following cmdlets are supported in our generally available module:
Cmdlet | Description |
Connect-MicrosoftTeams | Connects an authenticated account to use for Microsoft Teams environment |
Disconnect-MicrosoftTeams | Disconnects from the Microsoft Teams environment |
Get-Team | Retrieves teams with particular properties or information |
Get-TeamChannel | Gets all the channels for a team |
Get-TeamHelp | Provides a list of commands for Microsoft Teams |
Get-TeamUser | Returns the users of a specific team |
New-Team | Provisions a new Team, or converts a group to a team |
New-TeamChannel | Adds a new channel to a team |
Add-TeamUser | Adds an owner or member to the team |
Remove-Team | Deletes a team |
Remove-TeamChannel | Delete a channel |
Remove-TeamUser | Removes an owner or member from a team |
Set-Team | Updates properties of a team |
Set-TeamChannel | Update Team channel information |
To get the last update about the available cmdlets, we can always hit the Microsoft link here: https://docs.microsoft.com/en-us/powershell/module/teams/?view=teams-ps
With the new module Microsoft improved the search. That means we can use the commands below for searches:
Get-Team -DisplayName MSB365
Get-Team -MailNickName MSB365
Get-Team -User [email protected]
Get-Team -Archived $true