How to manage Microsoft Teams using PowerShell
The New-Team cmdlet helps create a new team and its associated unified Microsoft 365 group. You can also specify team settings using the following script.
- New-Team
- [-DisplayName <String>]
- [-Description <String>]
- [-MailNickName <String>]
- [-Classification<String>]
- [-Visibility <String>]
- [-Template <String>]
- [-Owner <String>]
- [-AllowGiphy <Boolean>]
- [-GiphyContentRating <String>]
- [-AllowStickersAndMemes <Boolean>]
- [-AllowCustomMemes <Boolean>]
- [-AllowGuestCreateUpdateChannels <Boolean>]
- [-AllowGuestDeleteChannels <Boolean>]
- [-AllowCreateUpdateChannels <Boolean>]
- [-AllowDeleteChannels <Boolean>]
- [-AllowAddRemoveApps<Boolean>]
- [-AllowCreateUpdateRemoveTabs<Boolean>]
- [-AllowCreateUpdateRemoveConnectors<Boolean>]
- [-AllowUserEditMessages<Boolean>]
- [-AllowUserDeleteMessages<Boolean>]
- [-AllowOwnerDeleteMessages<Boolean>]
- [-AllowTeamMentions<Boolean>]
- [-AllowChannelMentions<Boolean>]
- [-ShowInTeamsSearchAndSuggestions<Boolean>]
- [-RetainCreatedGroup<SwitchParameter>]
- [<CommonParameters>]
The following script helps create a team from an existing Microsoft 365 group. The script shows only a few team settings for example purposes.
- New-Team
- -GroupId <String>]
- [-Owner <String>]
- [-AllowGiphy <Boolean>]
- [-GiphyContentRating<String>]
- [-AllowStickersAndMemes <Boolean>]
- [-AllowCustomMemes <Boolean>]
- [-AllowGuestCreateUpdateChannels <Boolean>]
- [-AllowGuestDeleteChannels <Boolean>]
- [-RetainCreatedGroup <SwitchParameter>]
- [<CommonParameters>]
Example 1: You can also create channels and add users to the newly created team.
- Connect-MicrosoftTeams -AccountId lucy@test.com
- $group = New-Team -MailNickname "TestTeam" -displayname "Work force" -Visibility "private"
- Add-TeamUser -GroupId $group.GroupId -User "Akash@test.com"
- Add-TeamUser -GroupId $group.GroupId -User "Mia@test.com"
- New-TeamChannel -GroupId $group.GroupId -DisplayName "marketing"
- New-TeamChannel -GroupId $group.GroupId -DisplayName "Sales"
Cmdlet: Set-Team
This cmdlet helps update team properties such as display name, description, visibility and the team settings. (Refer New-Team cmdlet script for team settings).
Example: Updating a team's DisplayName.
1 Set-Team -GroupId 2f162b0e-36d2-4e15-8ba3-ba229cecdccf -DisplayName "Updated TeamName" -Visibility Public
Cmdlet: Remove-Team
This cmdlet deletes the specified team and the group associated with it.
- Remove-Team
- -GroupId<String>
- [<CommonParameters>]
Using PowerShell to manage Microsoft Teams requires you to have appropriate permissions. It can also be complex, time-consuming and error-prone. M365 Manager Plus helps simplify Teams management with its bulk management feature.
How can M365 Manager Plus help?
The user-friendly interface helps you easily create, update, and delete teams in bulk by simply importing a CSV file. You can also create automated workflows in the tool to manage Teams. This will help save time and reduce your workload.
Managing Microsoft teams in bulk using M365 Manager Plus:
- Navigate to the Management tab.
- Go to Microsoft Teams in the left pane.
- Select Team Tasks > Create Team or any other required action.
- Select the required Microsoft 365 Tenant from the drop-down box.
- Import the required CSV file.
- Click Import Team(s).
The imported CSV file must consist of details such as DisplayName, Description, Visibility, Owner, and rules that help manage user permissions in Microsoft Teams.
To learn more about managing Microsoft Teams using M365 Manager Plus, click here.