Today, we’ll look at using the PowerShell New-Team Template to make it simple for your IT administrators to create Microsoft Teams channels that adhere to these straightforward best practices.
Microsoft Teams is emerging as the default means of communication within organizations that utilize M365. Users can
However, as Microsoft Teams usage has increased, so has the number of duplicate and unused channels. Which can quickly lead to an ongoing problem of “Teams sprawl” if common sense controls aren’t put in place to control
To install the required cmdlets, run the following commands in a PowerShell session:
Install-Module -Name PowerShellGet -Force -AllowClobber
Install-Module -Name MicrosoftTeams -Force -AllowClobber
Before you set off to create new templates for teams, you will probably want to first see if the existing templates will satisfy your specific needs.
To see a list of all currently available templates, run the following in PowerShell:
This will return one of the two following objects:
In the event of a successful call, the ITeamTemplateSummary will include an OdataId, along with the template’s name, a short description, and the number of apps and channels associated with the template.
To create a new M365 Teams instance with the PowerShell New-Team Template, run the following:
New-Team -DisplayName "My New Team" -Visibility Private -Description "A New Private Team" -MailNickName "MyTeamsManager" -Owner "firstname.lastname@example.org"
The Microsoft documentation recommends creating a custom template by copying, and updating an existing template, like so:
PS C:> $template = Get-CsTeamTemplate -OdataId '/api/teamtemplates/v1.0/com.microsoft.teams.template.AdoptOffice365/Public/en-US'
PS C:> $template.Category = $null
PS C:> $template.DisplayName = “My new template”
PS C:> $template.Channel +=
displayName="My new channel";
PS C:> New-CsTeamTemplate -Locale en-US -Body $template
Notice that we’ve stored an existing template in the $template variable, which we can then update by accessing and updating its various properties with dot notation. We then call the New-CsTeamTemplate cmdlet and pass our updated template as the -Body argument.
To create a new M365 Teams instance from a template, you can use the New-Team cmdlet with a -Template argument, like so:
New-Team -Template <OdataId>
To update an existing M365 Teams template, we can simply get the template we want to update with the Get-CsTeamTemplate cmdlet, and store it locally like so:
$template = Get-CsTeamTemplate -OdataId <OdataID>
Once we have the template stored in the $template variable, we can access and update properties on the object like so:
$template.FunSetting.AllowCustomMeme = $true
$template.FunSetting.AllowGiphy = $true
$template.FunSetting.AllowStickersAndMeme = $true
After we’ve got the local object into the desired state, we can save our changes by using the Update-CsTeamTemplate cmdlet:
Update-CsTeamTemplate -OdataId <OdataId> -Body $template
For a complete listing of available properties that you can update, refer to the Microsoft documentation on the topic.
While PowerShell is a very powerful tool, there is a tendency when using it to write one-off scripts, perhaps like our examples above.
This is a quick method to create the desired resources, to be sure, but it isn’t as efficient as it could be because it is very likely that such scripts will not be shared within your organization effectively for continued use.
This means that there will inevitably be duplicated efforts across your IT department over time.
Thankfully, CoreView provides a simple way to store such scripts as custom actions within its automation workflow framework, so that once a script is written, it can be stored and shared across your organization very easily.
To learn more about CoreView’s wide range of built-in automation actions and to learn about how you can store your custom scripts as CoreView actions for easy access and reuse by your team, schedule your demo.