Connect to Microsoft Teams & Create a Team with PowerShell

Introduction

Microsoft Teams is the main collaboration tool in the Microsoft environment. Our organization users, management, staff, employees, and even admins can use teams to communicate and collaborate with each other. Messages also have private conversations and public conversations as well, with their fellow employees.

Steps 1. Install the Teams module/ Package to the PowerShell

Generally, Windows PowerShell does not come with all of the commands, so we need to install the Microsoft Teams PowerShell module/package.

First thing just want to make sure the Execution Policy from Restricted to RemoteSigned or Unrestricted PowerShell allows local PowerShell scripts to run.

Open the PowerShell as Administrator

  • Type Set-ExecutionPolicy Unrestricted
  • Type “Y” to change the execution policy
  • Then press enter

Windows Powershell CMD

Steps 2. Install Microsoft Teams Module

Type “Install-Module -name MicrosoftTeams -Force -AllowClobber”

* “AllowClobber” means if there's already a version on there, it's going to overwrite it with the newest version.

Then press enter to install the Microsoft Teams Module.

Install module

Steps 3. Connect Microsoft Teams from PowerShell

Type “Connect-MicrosoftTeams”

Then press Enter.

Connect teams

You have to enter the credentials to authenticate.

Teams

After Successfully authenticating, The PowerShell connected to Microsoft Teams as well.

Success

Steps 4. Create a team

So, now you can create a team as well, using the following command line.

New-Team -DisplayName ShifaTech -Description "Team to post an article on C# corner" -Visibility Public.

Then Enter.

New Teams

The team has successfully created the Microsoft Teams

Teams created

Steps 5. Office portal using the web address

Go to the office portal using the web address https://portal.office.com and use your credentials to log into the portal.

After Entering the credential, the link will be redirected to the Microsoft365 home page.

Then click the App Launcher Icon.

Then click Teams, and it will open with the new tap of the browser.

Microsoft Portal

Click Teams to see if the team was created by using PowerShell.

General

Steps 6. Manage Teams

Click the Manage Teams to add a member to the team “ShifaTech”

Add member


Similar Articles