---
title: Managing Microsoft Teams with PowerShell
tags: [powershell, teams, microsoft-teams, office365, administration]
---

# Managing Microsoft Teams with PowerShell

Microsoft Teams management via PowerShell allows for bulk operations, automation of team creation, and configuration of settings not always available in the UI.

**Parent Topic:** [[programming/PowerShell/PowerShell|PowerShell Comprehensive Guide]]
**Related:** [[programming/PowerShell/Microsoft365Groups|Managing Microsoft 365 Groups with PowerShell]]

## Prerequisites

Install the Microsoft Teams module:
```powershell
Install-Module -Name MicrosoftTeams
```

Connect to your tenant:
```powershell
Connect-MicrosoftTeams
```

## Team Management

### Create a New Team
```powershell
New-Team -DisplayName "Finance Dept" -Description "Team for Finance Department" -Visibility Private
```

### Get Teams
```powershell
# Get all teams the current user belongs to
Get-Team

# Get a specific team by display name (requires filtering)
Get-Team | Where-Object {$_.DisplayName -eq "Finance Dept"}
```

### Archive a Team
```powershell
$groupId = (Get-Team | Where-Object {$_.DisplayName -eq "Finance Dept"}).GroupId
Set-TeamArchivedState -GroupId $groupId -Archived $true
```

## Channel Management

### Create a Standard Channel
```powershell
New-TeamChannel -GroupId $groupId -DisplayName "Budgeting"
```

### Create a Private Channel
```powershell
New-TeamChannel -GroupId $groupId -DisplayName "Payroll" -MembershipType Private
```

## Member Management

### Add a Member
```powershell
Add-TeamUser -GroupId $groupId -User "jdoe@yourdomain.com"
```

### Add an Owner
```powershell
Add-TeamUser -GroupId $groupId -User "admin@yourdomain.com" -Role Owner
```

### Remove a Member
```powershell
Remove-TeamUser -GroupId $groupId -User "jdoe@yourdomain.com"
```

---
Return to [[programming/PowerShell/PowerShell|PowerShell Comprehensive Guide]]