Читать книгу MCA Microsoft 365 Teams Administrator Study Guide - Ben Lee - Страница 63

Install and Connect to Teams PowerShell

Оглавление

From a computer running PowerShell 5.1, first install the Teams module from the PowerShell Gallery at powershellgallery.com. If the machine has Internet access and administrative rights, you should be able do this directly from inside PowerShell itself by running the following command (see Figure 1.12):

Install-Module -Name MicrosoftTeams

You will need to accept the confirmation prompt, and if you have the Skype for Business Connector already installed, you will need to also use the -AllowClobber switch to overwrite some of the existing cmdlets with the ones from the Teams module (as Teams now includes the required Skype for Business components).

If you are unable to automatically download the module from the PowerShell Gallery repository, refer to the site where it provides instructions about how to manually download and copy files to the correct locations for PowerShell to find them.


FIGURE 1.12 Installing the Teams PowerShell module

Next, we need to load up the Teams module and start a connection to our tenant. Depending on what you want to work with, you may have to connect twice: once to Teams and once to Skype for Business Online (remember that Teams shares a lot of its voice components with Skype for Business Online). When establishing the connection, there are several ways you can pass through credentials, depending on if you are using modern authentication with multifactor authentication (MFA) enabled. It is generally recommended that if you are going to perform automated scripting you have an account that does not require MFA (or at least does not require MFA from wherever you are running the script, for example, inside the company network) as this can be a challenge to automate.

#Import the Teams / SfBO module Import-Module -Name MicrosoftTeams #Connect to Teams Connect-MicrosoftTeams #Create an SfBO session and connect to it $SfBOnlineSession = New-CsOnlineSession Import-PSSession $SfBOnlineSession

As you are connecting to each service, you will see two modern authentication prompts (see Figure 1.13) where you can enter your credentials. (It should be an account with some Teams administrator permissions; otherwise, you won't be able to get very far, but more on that in later chapters!)


FIGURE 1.13 PowerShell modern authentication prompt

Now you have a connection to O365 and can start viewing and updating settings. Just be careful because while PowerShell is an amazing management tool, you can easily modify settings for large numbers of users in one go, so make sure you thoroughly test any scripts or commands you are going to run. Usually PowerShell cmdlets that modify settings have both a -WhatIf and -Confirm switch that you can use as a bit of a safety net.


To get an overview of PowerShell, visit docs.microsoft.com/en-us/powershell/.

To find out more about the Microsoft Teams PowerShell module, visit powershellgallery.com/packages/MicrosoftTeams.

For Microsoft's guide to managing M365 with PowerShell, visit docs.microsoft.com/en-us/microsoft-365/enterprise/manage-microsoft-365-with-microsoft-365-powershell.

MCA Microsoft 365 Teams Administrator Study Guide

Подняться наверх