Get Started with Teams PowerShell

PowerShell is very powerful (no pun intended) but if you don’t know what you are doing it can be dangerous, making big changes to your environment without prompting for confirmation.  If you run ANY PowerShell scripts against your Office 365 tenant you alone are fully responsible for the actions undertaken, so please ensure you are fully confident in the source of your information.

I would recommend having a look at the Microsoft Learn module as a first step.  It should only take approx 1h to complete. Introduction to PowerShell – Learn | Microsoft Docs

Then review the guidance on managing Microsoft Teams using PowerShell from Microsoft Microsoft Teams PowerShell Overview – Microsoft Teams | Microsoft Docs

If you are looking at scripts for Microsoft Teams from a blog (like this one) I would recommend checking  them against MicrosoftTeamsPowerShell Module | Microsoft Docs.  This helps you learn more about the scripts but also lets you check the cmdlets (commands) you intend to use are still valid.

Finally, ALWAYS close your PowerShell Windows when you are not actively using them.  This closes the connection and logs you out, helping to keep your environment secure.

That said, here is how I would recommend setting up Teams PowerShell.  Note I do not use a variable for the credential as the official blog suggests but wait for the log in prompt instead.  In my opinion this works better with MFA.

  1. Open Powershell in Windows with Admin – right click on your start button and choose Windows PowerShell (Admin)
  2. Install Teams Powershell by running this script (see Install Microsoft Teams PowerShell – Microsoft Teams | Microsoft Docs)
Install-Module -Name MicrosoftTeams
  1. Import the newly installed module into the open PowerShell window
Import-Module MicrosoftTeams
  1. Log in to Microsoft Teams 
Connect-MicrosoftTeams
  1. You are now ready to manage Teams using PowerShell

When you are installing PowerShell Modules, you will always be prompted to confirm download from the repository, as shown below.  You should only confirm one repository at a time using Y response.

Once set up you can then log in future by:

  1. Open Powershell in Windows with Admin – right click on your start button and choose Windows PowerShell (Admin)
  2. Import the Teams module into the open PowerShell window
Import-Module MicrosoftTeams
  1. Log in to Microsoft Teams 
Connect-MicrosoftTeams

To Update Teams Powershell

  1. Open Powershell in Windows with Admin – right click on your start button and choose Windows PowerShell (Admin)
  2. Run the Update Script
Update-Module MicrosoftTeams
  1. Import the Teams module into the open PowerShell window
Import-Module MicrosoftTeams
  1. Log in to Microsoft Teams 
Connect-MicrosoftTeams

Published by sfennah

I am a freelance learning professional with over 22 years’ experience including holding 30+ Microsoft certifications and Microsoft Certified Trainer status since 2008.

One thought on “Get Started with Teams PowerShell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: