Getting the Teams PS Module
First, how do we get our hands on the module? First we can see what Microsoft has documented in their PowerShell Gallery – https://www.powershellgallery.com/packages/MicrosoftTeams/0.9.0. As we can tell from the link, this is still an early release as the module version is less than 1.0.0. The current list of cmdlets is small at the moment with a concentration on Team Users, Channels and Team configuration settings.
Now like a lot of modules available for PowerShell 5.0, we can either save the Teams PS module for later use or installation on another computer
Save-Module -Name MicrosoftTeams -Path <path><!--more-->
Or we can install the module with this one-liner:
Install-Module -Name MicrosoftTeams
** Note ** Just remember that in order to install the module, you need to have Administrative rights (right click and ‘Run As Administrator’) for Windows PowerShell as well as Internet access to get the module from its repository.
Sample install:
Now that we have the module installed, we need to connect to the service connection URL for Teams. First we bring up a new Powershell Windows and check to see if the Teams PS Module is already loaded:
If the module is not loaded, it will be missing from the Get-Module list:
Otherwise it will show like this:
Once the module is loaded, we can now connect to the service for Teams:
Connect-MicrosoftTeams
Enter your credentials for your tenant and then you are connected:
Once you are connected we can get a list of cmdlets available in the Teams module:
Here is the list again in text format:
Add-TeamUser Get-Team Get-TeamChannel Get-TeamFunSettings Get-TeamGuestSettings Get-TeamMemberSettings Get-TeamMessagingSettings Get-TeamHelp Get-TeamUser New-TeamChannel New-Team Remove-Team Remove-TeamChannel Remove-TeamUser Set-TeamFunSettings Set-TeamGuestSettings Set-TeamMemberSettings Set-TeamMessagingSettings Set-Team Set-TeamChannel Set-TeamPicture Connect-MicrosoftTeams Disconnect-MicrosoftTeams
Now What can we do?
From the above cmdlets its apparent that we can add Teams, list (get) Teams, remove Teams, configure Teams and even configure some Channel and Team Member settings. One thing to note is that this module is version 0.9.0, so I would expect there will be some growth over the coming months with available cmdlets for managing Teams. Here is a quick run through of the 4 major sets – New, Get, Set and Remove for Teams.
Adding a Team (New)
Adding a new team can be simple:
New-Team -DisplayName 'IT Department'
A bit more complex:
New-Team -DisplayName 'IT Department' -AccessType Private -AddCreatorAsMember $True -Description 'Collaboration for IT Department'
You will receive very little feedback when creating the group:
List Groups (Get)
The Get-Team cmdlets is rather limited and is in Beta for sure. The cmdlets either lists all the Teams present or it can list the Teams that a user is a member of.
Get-Team
Only three properties can be displayed for each Team with this cmdlets.
Configure Team (Set)
the only settings that are allowed to be manipulated now are the DisplayName, Alias, Description, Classification and AccessType
Set-Team
For example, we have a Team, like the ones already created which needs the Team description updated. We can use the Set cmdlets to change this value.
Set-Team -GroupID '933fe926-555a-4832-87d1-8f700736e003' -Description 'Top Secret R&D Collaboration'
There are several parameters that are not allowed yet and it is due to the Beta nature of the cmdlets – Classification and AccessType for sure do not work.
Removing a Team (Remove)
To remove a group, all you need is the GroupID and:
Remove-Team -GroupId 'e3da1526-e0fa-4325-a923-89bb99415990'
… the Team is now gone.
Additional Configuration
In addition to general Team configuration and creation, we can also change Fun settings, Team Guest settings, Team Member settings, Team Messaging settings as well as Team Channel settings. Here are some samples from each of these options:
New-TeamChannel -GroupId <String> -DisplayName <String> [-Description <String>] [<CommonParameters>] Set-TeamFunSettings -GroupId 0ebb500c-f5f3-44dd-b155-cc8c4f383e2d -AllowGiphy true -GiphyContentRating Strict Set-TeamMessagingSettings -GroupId 4ba546e6-e28d-4645-8cc1-d3575ef9d266 -AllowUserDeleteMessages false-AllowChannelMentions True Set-TeamGuestSettings -GroupId a61f5a96-a0cf-43db-a7c8-cec05f8a8fc4 -AllowCreateUpdateChannels True Set-TeamMemberSettings -GroupId 4ba546e6-e28d-4645-8cc1-d3575ef9d266 -AllowDeleteChannels true -AllowAddRemoveApps False
Final Notes
While this may be a good start to manipulating Teams via PowerShell, the cmdlets have a long ways to go. There needs to be more development into these cmdlets as well as the information that can be configured / revealed with PowerShell. Look for future articles here once this PowerShell module is fleshed out more.
Helpful Tip
Make sure you have the correct version of PowerShell for running this module, as there is a 32-bit and a 64-bit download. Why is this a problem? You won’t be able to load the Teams PowerShell module if the PowerShell window you are using is in 32-bit mode: