If you are a System Administrator in your company and managing IT infrastructure, you must know about PowerShell. It’s a language that IT people use to automate stuff like spinning up VM, shutting down services on weekends, generating reports, etc. If an Enterprise has been using Teams in their environment for communication, a System Administrator might have a lot of jobs to maintain its performance, administration, and usability.

In this blog, I am going to show some essential PowerShell scripts which System Admins or Engineers can use to automate their Team’s environment and not let their users wait long.

Installing PowerShell module for Teams and Skype for Business Online
You might be thinking why I am saying to install the Teams PS module and SfB Online because the Teams PowerShell module does not have enough commands available to manage meetings and messaging policies. That is why we need Skype for a Business Online connector to do the job.

Install-Module MicrosoftTeams

You will be prompt with a warning to install from an un-trusted repository. Just say “A” which “Yes to All” in order to proceed.

To install Skype for Business Online connector, run the below commands:

Import-Module SkypeOnlineConnector
$userCredential = Get-Credential
$sfbSession = New-CsOnlineSession -Credential $userCredential
Import-PSSession $sfbSession

**If you have MFA enabled account, follow this document

Connecting to Microsoft Teams

Once the module is installed, you are good to get connected with Teams from PowerShell by running the below command

Connect-MicrosoftTeams -Credential $credential

Creating a team in Teams

If you do not have any teams yet, start by creating a team using the below command:

New-Team -DisplayName “Medium Bloggers” -Description “For blog writing people”

Adding team user as Owner

Running the below command will add the user as Owner for a team.

Adding team user as Member

Running the below command will add the user as Member for a team.

Changing the display picture for a team

Running the below command will update the display picture for the team.

There is a lot we can do on Teams using PowerShell which cannot be fully covered in a single blog. I will be writing a scenario-based blog, particularly on managing Teams with PowerShell.

About the Author

Leave a Reply

Your email address will not be published.

You may also like these