Hello Readers, I hope you’re well.

Just a quick one today. I saw on Twitter that the latest version of the Microsoft Teams PowerShell module, version 2.0 has been released. And while that on it’s own isn’t particularly exciting or newsworthy. There are some changes with this release that are worth noting.

Tiny bit of background first. We all know that the SkypeOnline PowerShell module has now been retired. There was a message centre announcement in December 2020 stating “Administrators can continue to use Skype for Business Online Connector till July 31, 2021 but after Feb 15, 2021 will not be able to download the module.”. They go on to tell you how to install the latest version of the Microsoft Teams PowerShell module and how to move from SkypeOnline to Teams PowerShell modules.

Version 2.0.0 of Teams PowerShell Module is available now for download: PowerShell Gallery | Microsoft Teams 2.0

What’s changed

New features, fixes and changes: 

  1. Use Connect-MicrosoftTeams as the single command to login and manage Teams and Skype for Business online. New-CsOnlineSession is no longer required to login and manage Skype for Business Online.
    • This will require a minor update from your side and make changes as documented here.
  2. No need to use Enable-CsOnlineSessionForReconnection to run long scripts or stay connected. 

How to update

First you need to uninstall the SkypeOnline PowerShell module. Follow these steps on how to move from Skype for Business Online Connector to Teams PowerShell module.

After that you only need to install the MicrosoftTeams PowerShell module. In an elevated PowerShell or ISE run teh following. I use Force to update from a previoud version.

Install-Module MicrosoftTeams -Force

How to connect

You can just keep it simple and run

$creds = Get-Credential
Connect-MicrosoftTeams -Credential $creds

This works fine, it just prompts you for your credentials every time you use it.

You can also store the credentials as an excrypted secure string and then call those as your creds variable.

First you need to save your password in a secure format

Read-Host “Enter Password” -AsSecureString |  ConvertFrom-SecureString | Out-File “c:\Scripts\Password.txt”

Next you can use the following to store the credentials as a variable to connect to Teams and other PowerShell modules.

$Username = “your.adminuser@domain.com”
$Password = cat “c:\Scripts\password.txt” | ConvertTo-SecureString
$Creds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username, $Password

Next you can connect

Connect-MicrosoftTeams -Credential $Creds

Bring it all together

I use one script to authenticate and connect to Micorosoft Teams, Exchange and Azure AD. Just replace your.adminuser@domain.com with your admin username. And change the location of your Password file

#You need to run this first to save your password as an encrypted file
#Read-Host “Enter Password” -AsSecureString |  ConvertFrom-SecureString | Out-File “C:\Scripts\Password.txt”

#Authenticate and connect to a new Microsoft Teams PowerShell session
$Username = “your.adminuser@domain.com”
$Password = cat “c:\Scripts\password.txt” | ConvertTo-SecureString
$Creds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Username, $Password
Connect-MicrosoftTeams -Credential $Creds

#Authenticate and connect to a new Exchange Online PowerShell session
Connect-ExchangeOnline -Credential $Creds -ShowProgress $true

#Authenticate and connect to a new Azure AD PowerShell session
Connect-MsolService -Credential $Creds

#Authenticate and connect to Azure AD using the Azure Active Directory PowerShell for Graph module
Connect-AzureAD -Credential $Creds

If you need to connect to more modules, just add them to the script. Connect to all Microsoft 365 services in a single PowerShell window – Microsoft 365 Enterprise | Microsoft Docs


If you use MFA, storing the creds won’t work. You’ll get an error if you try.

Once connected to Teams PowerShell, you’ll see that all Teams and CS (communication server/SkypeOnline) commands are available. Don’t believe me? Run the following

get-command -Module MicrosoftTeams | out-file c:\commands.txt

If you run a get-command -Module MicrosoftTeams | measure you get 568 commands

Wrap up

Not having to use new-csonlinesession to get at the SkypeOnline commands is a huge win. This means you get all of the commands you need in a single connection. And because, unlike the SkypeOnline PowerShell module, the Teams PowerShell module sessions stay connected until you close out or disconnect, you can run it all day without disconnects, either just to stay connected and dip in and out to do specific tasks or you can run long scripts for big jobs.

Additional Resources