Back to Blog

Managing Teams with PowerShell

Image of Nathan O'Bryan MCSM
Nathan O'Bryan MCSM
no1-1

If your familiar with my writing, you know I'm a huge proponent of Office 365 administrators learning and using PowerShell. While it may be true that some admin tasks are easier to accomplish with a GUI, I'm strongly of the opinion that doing as much as possible in PowerShell will help build invaluable skills.

To that end, I recently decided it was time for me to figure out how to manage Teams with PowerShell. In this blog post I'll walk though some common, and maybe some less common, admin tasks for Microsoft Teams using PowerShell. There will be no GUI screenshots in this post. By the end of this blog, you should be able to put together a decent Teams management script.

Here's a list of the admin tasks we'll cover

  • Creating Teams
  • Managing Teams Membership
  • Adding Channels
  • Setting Team Settings

Teams PowerShell Module

As it's best to start at the beginning, lets first look at installing the Teams PowerShell module. Installing PowerShell modules is not so difficult these days, as shown in the screenshot below.

no1-1

After the module is installed, we run Import-Module then check that our Teams module has been installed and loaded.

no2

Then let's look at the cmdlets that are available in this module. The cmdlet Get-Command -Module Microsoft Teams will show you the cmdlets available in this module.

no3-1

Creating Teams

Creating a new Team with PowerShell is done with the New-Team cmdlet. The options you can use to create your new Team are the same as creating a Team via the GUI. Of course, options mean using the proper parameters, as listed in the linked documentation from Microsoft.

I’m not going to walk though all the attributes of the New-Team cmdlet here, but I do want to mention the option to create a Team from a template. The attribute -Template allows you to specify an already created Team to use as a template for your new Team. This can be an invaluable tool when many Teams need to be created, a likely situation for those deploying Teams with PowerShell.

Likewise, the -Group attribute is used to specify a group to convert to a Team, saving work when groups with the necessary membership already exist within your tenant.

Customizing Teams

After your Teams are created, you will often need to customize them.

Set-Team allows the administrator to reset the options chosen during the original Team creation. This cmdlet is most useful when many Teams are created from a template but need customization after the original creation.

As with the GUI, creating Teams with PowerShell doesn’t allow much for customization of the Team itself. It’s necessary to run the Add-TeamUser and New-TeamChannel after the team is created to customize the Team after creation.

Additionally, you can use the Set-TeamFunSettings to turn on or off some of the “fun” settings within Teams. Options that allow custom memes, giphy, and stickers are set with this cmdlet.

Set-TeamMessagingSettings is a cmdlet not yet fully implemented. It allows the administrator to control mentions within Teams, and who can delete messages within a Team.

Set-TeamMemberSettings controls the rights that are granted to Teams member. Members are users within your organization that are members of your Teams.  

Set-TeamGuestSettings can be used to grant rights to guests to create, update, or delete channels.

Set-TeamPicture will allow you to upload a picture for your Team. In my testing, I find it can take an hour or more for a picture to show on your Team. Patience is very much inorder with this cmdlet.

Get* and Remove* Teams cmdlets

The above cmdlets are all for making changes to your Teams. The remaining cmdlets in the MicrosoftTeams PowerShell module allow you to list configuration information about your Teams or remove the previous configurations of your Teams.

Since the cmdlets closely mirror the Set, Add, and New cmdlets I’m not going to use space here to detail them each. Just remember that Get cmdlets show you information, and Remove cmdlets do the work of deleting settings and Teams themselves.

One Get cmdlet I do want to point out is the Get-TeamHelp cmdlet. Currently the documentation for this cmdlet is almost totally blank. All I can figure out that it does is list the PowerShell cmdlets that are included in the Teams module. Since Get-Command already does this, I don’t see much of a point to this cmdlet. Maybe Microsoft has some plans for its use in the future.

Putting cmdlets Together Into a Script

The greatest strength of PowerShell is always the ability to put together cmdlets into operations scripts you can use over and over for deployment and management tasks.

At the time of this writing, the PowerShell module for Teams is new and not well developed. Teams themselves are still be developed into what will eventually be a full replacement for Skype for Business. Microsoft eventually plans to have full enterprise voice functionality in Teams, and these features will hopefully come with new cmdlets.

This script on Microsoft’s documentation platform gives a good example of a Teams deployment script.  I always find it helpful to start with any existing script and modify it to meet my specific needs. Plagiarism is bad for a writer, but great for an IT pro trying to get a script done.

Summary

PowerShell is a great tool that all Office 365 administrators need in their tool bags. I encourage all the administrators I work with to complete as many tasks as they can using PowerShell as often as they can. Even in cases where your sure you can get the required work done via a GUI it’s a good idea to force yourself to use PowerShell as a learning experience.

The PowerShell module for Teams is far from mature, as Teams itself is still heavily in development. Staying up with this module as new versions are released will provide you with many opportunities to grow your Teams deployment and management skills.

Start Your

 


woman and child using laptop computer

Microsoft Teams for Business vs. Microsoft Teams for Education

Image of Matthew Levy
Matthew Levy

With the COVID-19 situation impacting the world in 2020, many, if not all, learning institutes are...

Read more
Coworkers seated at office table collaborating

Monitoring Microsoft Teams: Track and Analyze Collaboration

Image of ENow Software
ENow Software

Microsoft Teams is a powerful collaboration tool that allows teams to communicate and work together...

Read more