PowerShell Teams Management: Create Teams and Channels

PowerShell Teams Management: Create Teams and Channels

PowerShell Tips Editor 2 min read
PowerShell Teams Management: Create Teams and Channels

New project starting Monday? Provision the Microsoft Teams team, create the channels, and add the members before the kickoff meeting — in one script run that takes less than a minute. PowerShell Microsoft Teams automation with the MicrosoftTeams module gives you cmdlets for every team lifecycle operation: create, configure, populate, and eventually archive or delete. This post covers the full workflow with practical examples for each stage.

Install and Connect MicrosoftTeams Module

The MicrosoftTeams module is available from the PowerShell Gallery. It uses modern authentication with MFA support through an interactive browser popup.

# Install the module
Install-Module -Name MicrosoftTeams -Scope CurrentUser -Force

# Connect (browser-based MFA login)
Connect-MicrosoftTeams

# Verify connection
Get-CsTenant | Select-Object DisplayName, TenantId

Make sure you install the latest version — the module has gone through major updates and older versions may have different cmdlet names or missing features.

Create a New Team

New-Team creates a new Microsoft Teams team backed by a Microsoft 365 Group. The owner must be a licensed M365 user. Visibility can be Public or Private.

# Create a private team
$team = New-Team `
    -DisplayName   "Project Alpha 2026" `
    -Description   "Team workspace for Project Alpha" `
    -Visibility    "Private" `
    -Owner         "[email protected]"

Write-Output "Team created. GroupId: $($team.GroupId)"
Team created. GroupId: a1b2c3d4-e5f6-7890-abcd-ef1234567890

Add Channels to a Team

Every team gets a General channel automatically. Use New-TeamChannel to add project-specific channels. Standard channels are visible to all members; private channels restrict access.

$groupId = $team.GroupId

# Add standard channels
$channels = @("Design", "Development", "QA", "Deployment")
foreach ($channel in $channels) {
    New-TeamChannel -GroupId $groupId -DisplayName $channel
    Write-Output "Added channel: $channel"
}

# Add a private channel with specific members
New-TeamChannel -GroupId $groupId `
    -DisplayName "Leadership" `
    -MembershipType Private

Add and Remove Members

Use Add-TeamUser to add members or owners. The -Role parameter accepts Member or Owner. Remove users with Remove-TeamUser.

$groupId = $team.GroupId

# Add multiple team members
$members = @("[email protected]", "[email protected]", "[email protected]")
foreach ($member in $members) {
    Add-TeamUser -GroupId $groupId -User $member -Role Member
    Write-Output "Added member: $member"
}

# Add an owner
Add-TeamUser -GroupId $groupId -User "[email protected]" -Role Owner

# Remove a member
Remove-TeamUser -GroupId $groupId -User "[email protected]"

Get Teams Usage Report

Retrieve all teams you have access to administer and pull basic metadata for reporting or auditing purposes.

# Get all teams in the tenant (requires Teams admin role)
$allTeams = Get-Team

$allTeams | Select-Object DisplayName, Visibility, Archived, GroupId |
    Export-Csv -Path "C:\Logs\teams-report-$(Get-Date -Format yyyyMMdd).csv" -NoTypeInformation

Write-Output "Total teams: $($allTeams.Count)"

# Get members of a specific team
Get-TeamUser -GroupId $team.GroupId | Select-Object User, Role, Name

Archive and Delete a Team

Archiving makes a team read-only but preserves its content — the right choice when a project ends. Hard deletion is permanent and should be a last resort.

$groupId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"

# Archive a team (read-only, content preserved)
Set-TeamArchivedState -GroupId $groupId -Archived $true
Write-Output "Team archived."

# Unarchive (reactivate)
Set-TeamArchivedState -GroupId $groupId -Archived $false

# Delete a team permanently — content is gone after soft-delete period
Remove-Team -GroupId $groupId
Write-Output "Team deleted."

Common Errors and Fixes

  • Module version conflicts with older Teams PowerShell: Microsoft has released multiple major versions of the MicrosoftTeams module with breaking changes between them. If cmdlets are missing or behave unexpectedly, check your installed version with Get-InstalledModule MicrosoftTeams | Select-Object Version and update with Update-Module -Name MicrosoftTeams. Version 4.x and later use a significantly improved architecture compared to 2.x versions.
  • Owner must be a licensed M365 user: New-Team fails if the specified owner doesn’t have a valid Microsoft 365 license that includes Teams. The error “User object not found” or “Owner not found” typically indicates either the UPN is incorrect or the account lacks the required license. Verify with Get-MgUser -UserId "[email protected]" | Select-Object AssignedLicenses.

Related Cmdlets / See Also

Wrapping Up

The MicrosoftTeams module covers the full team lifecycle from provisioning through archiving, making project kickoff automation straightforward. As a next step, build a project kickoff function that accepts a project name and member list as parameters and creates the team, all standard channels, and member assignments in a single call — a 30-second provisioning workflow.

Send-Item -To