Teams PowerShell

If you’ve spent any time administering Microsoft Teams at scale, you’ll quickly discover that the Teams Admin Center only gets you so far. It’s great for one-off changes, but once you’re managing hundreds or thousands of teams, user policies, phone system settings, or governance controls, clicking through the GUI becomes slow, inconsistent, and error-prone.

This is where PowerShell becomes indispensable.

In my experience across service desk, sysadmin, and network engineering roles—and now moving deeper into security—PowerShell has consistently been the difference between reactive admin work and repeatable, auditable operations. Microsoft Teams is no exception. While Teams is ultimately backed by Microsoft 365 services like Azure AD, SharePoint, and Exchange, PowerShell gives you a single pane of glass for automation and control.

This article goes beyond basic cmdlet lists. I’ll walk through how Teams PowerShell works in the real world, where it excels, where it falls short, and how to use it safely in production environments.


Understanding the Microsoft Teams PowerShell Module

Microsoft Teams is managed via the MicrosoftTeams PowerShell module, which replaces much of the older Skype for Business Online tooling.

Key things to understand upfront

  • Teams PowerShell does not manage everything
  • Some settings live in Exchange Online, Azure AD, or SharePoint Online
  • Cmdlets often map directly to Teams policies, not individual user settings
  • Changes can take time to propagate (sometimes hours)

This hybrid reality catches many admins off guard. You might run a PowerShell command successfully and assume it failed because the change isn’t visible immediately. In most cases, it’s simply backend replication delay.


Installing and Connecting to Microsoft Teams PowerShell

Install the module

On a modern admin workstation, installation is straightforward:

Install-Module -Name MicrosoftTeams -Force -AllowClobber

I strongly recommend:

  • Running PowerShell as Administrator
  • Keeping this module updated, as Teams cmdlets change frequently

Connect to Microsoft Teams

Connect-MicrosoftTeams

This uses modern authentication and respects Conditional Access policies. From a security perspective, this is a good thing—but it also means:

  • MFA is mandatory
  • Service accounts require careful design (PIM or certificate-based auth)

Core Administration Tasks You Should Be Automating

1. Managing Teams at Scale

Creating Teams via the GUI works fine for one-offs. At scale, it quickly becomes unmanageable.

Example: List all Teams in the tenant

Get-Team

Example: Create a new Team

New-Team -DisplayName "Finance Operations" -Visibility Private -Description "Finance Ops Team"

Real-world insight:
In production environments, Teams creation should almost always be restricted and automated—often via provisioning workflows or approved templates. PowerShell is ideal for enforcing naming standards and ownership rules.


2. Managing Team Membership and Ownership

Adding users manually is error-prone, especially when people change roles.

Add-TeamUser -GroupId <GroupID> -User [email protected] -Role Member

Promoting an owner:

Add-TeamUser -GroupId <GroupID> -User [email protected] -Role Owner

Lesson learned the hard way:
Always ensure at least two owners per Team. I’ve seen Teams become unmanageable because the sole owner left the organisation, triggering access and compliance issues.


Teams Policies: Where PowerShell Really Shines

Policies are where PowerShell becomes non-negotiable.

Common policy types

  • Messaging policies
  • Meeting policies
  • Calling policies
  • App permission policies
  • App setup policies

Example: Assign a messaging policy to a user

Grant-CsTeamsMessagingPolicy -Identity [email protected] -PolicyName "RestrictedMessaging"

Important operational tip:
Policies apply asynchronously. Always document the change time and validate later—especially when troubleshooting user complaints.


Governance and Compliance Using PowerShell

Teams sprawl is one of the biggest problems in Microsoft 365 environments.

PowerShell allows you to:

  • Audit inactive Teams
  • Identify Teams without owners
  • Enforce lifecycle management

Example: Find Teams with no owners

Get-Team | Where-Object {$_.Owners.Count -eq 0}

From a governance perspective, this is gold. Orphaned Teams often:

  • Retain sensitive data
  • Violate retention policies
  • Create legal and security risks

Reporting and Auditing: Filling the Admin Center Gaps

The Teams Admin Center is not a reporting tool.

PowerShell enables you to export data for:

  • Security reviews
  • Risk assessments
  • Management reporting

Example: Export Teams list to CSV

Get-Team | Select DisplayName, Visibility, Description | Export-Csv TeamsReport.csv -NoTypeInformation

This data becomes especially valuable when paired with:

  • SharePoint site audits
  • Sensitivity labels
  • External sharing reports

Common Limitations (and How to Work Around Them)

Let’s be honest—Teams PowerShell isn’t perfect.

Limitations I’ve encountered

  • Some settings can’t be read back
  • Cmdlets occasionally lag behind new Teams features
  • Error messages are often vague

Workarounds

  • Combine Teams PowerShell with:
    • Exchange Online PowerShell
    • Azure AD PowerShell / Graph
  • Validate changes using multiple tools
  • Maintain a change log for Teams policy updates

Security Considerations When Using Teams PowerShell

From a cybersecurity perspective, PowerShell access to Teams is powerful—and risky.

Best practices I strongly recommend:

  • Use least privilege roles
  • Protect admin accounts with MFA and Conditional Access
  • Avoid shared admin credentials
  • Log and monitor PowerShell activity

In mature environments, Teams administration should be treated as a security-sensitive operation, not basic collaboration admin.


When PowerShell Is Better Than the GUI (and When It Isn’t)

PowerShell is best for:

  • Bulk changes
  • Automation
  • Governance enforcement
  • Auditing and reporting

GUI is better for:

  • One-off troubleshooting
  • Visual validation
  • New admins learning Teams

In practice, strong Teams administration uses both.


Conclusion: PowerShell Is Essential for Serious Teams Administration

If you’re managing Microsoft Teams in anything larger than a small business, PowerShell isn’t optional—it’s foundational.

It gives you:

  • Scale
  • Consistency
  • Auditability
  • Governance control

More importantly, it allows you to treat Teams like the enterprise system it actually is, rather than “just a chat app”.

In my experience, the organisations that struggle with Teams are rarely short on features—they’re short on structure, automation, and governance. PowerShell is the tool that bridges that gap.

If you’re serious about managing Microsoft Teams properly, invest the time to master Teams PowerShell. It will pay dividends in reliability, security, and your own sanity as an IT professional.

Leave a Reply

Your email address will not be published. Required fields are marked *