Microsoft has just released the long awaited powershell module for Microsoft Teams in release 0.90 Beta. Administrators can now manage and automate their Microsoft Teams Teams π using this Module.
The module is located at PowershellGallery.com, and below are the steps to install.
https://www.powershellgallery.com/packages/MicrosoftTeams/0.9.0
- Using powershell V5 it includes the PowershellGet Module which will connect to the PowershellGallery, here you can search and install modules.
- To search Powershell Gallery for Microsoft Teams type:
Find-Module *Teams
- We’ve connected to the PowershellGallery.com and found that there is a module called MicrosoftTeams
- Save the Module to the location of your choice type:
Save-Module MicrosoftTeams -Path C:\dev\MSTeams
- To install the downloaded module type:
Install-Module MicrosoftTeams
- Once the module is installed lets see what cmdlets are available, there are a couple ways to do this:
Get-Module MicrosoftTeams -ListAvailable | % { $_.ExportedCommands.Values }
Or
Get-Teamhelp
- Β It will populate the list of cmdlets:
- Ok now that we’ve got the module installed lets get connected, the module includes a connect cmdlet
Connect-MicrosoftTeams
- Login to your Tenant with the appropriate privileges:
- Once you authenticate it will return your connection and tenant information
- Let’s run a few cmdlets to see what it brings up:
PS C:\> Get-Team GroupId DisplayName Description ------- ----------- ----------- f1109f53-c77c-445c-a86e-e8f8a19fad49 Demo Team Demo Team
- Creating a team is pretty straight forward see the below example although no verbose information is provided :
PS C:\> New-Team -DisplayName 'Powershell Teams Team' -AccessType Private -Description 'First team created via powershell' -Verbose GroupId ------- bc47094f-68b8-48e0-9ffa-23ac89e0b109
- Lets add a channel to the new Team:
PS C:\> New-TeamChannel -GroupId 'bc47094f-68b8-48e0-9ffa-23ac89e0b109' -DisplayName 'Channel 1' Id DisplayName Description -- ----------- ----------- 0dedb767-4d0f-495f-bcd2-041add2fa8a5 Channel 1
So as you can tell this can become very powerful when creating and managing multiple teams. The module is still in the early stages , hopefully in the next iteration it will include some additional features and policy management.