Microsoft Teams

Microsoft Teams is a chat and collaboration platform designed to simplify group work. In comparison to the previous services, Teams comes together with O365 bundles, as shown in the following screenshot:

https://docs.microsoft.com/en-us/microsoftteams/office-365-licensing:

Setting up a connection to Microsoft Teams works in a similar way to the previous services. There is a dedicated PowerShell module available named MicrosoftTeams, which brings us to the following code:

#Install PowerShell module for Teams
Install-Module MicrosoftTeams -Force

#Credentials to connect to online service
$UserCredential = Get-Credential -UserName '[email protected]' -Message 'Password'

#Connect to service with user name and password
#proving if the connection has been established correctly
try {
Connect-MicrosoftTeams -Credential $UserCredential
$connectionSuccessfullyEstablished = $true
}
catch {
$connectionSuccessfullyEstablished = $false
}

If you want to use a multifactor authentication method instead, this will work the same as seen previously with the Connect-MicrosoftTeams cmdlets. And if you want to disconnect from specific tenants, you can use the Disconnect-MicrosoftTeams cmdlet.

The current list of the available cmdlets is much smaller than lists from previous services:

#Showing all cmdlets
Get-Command -Module MicrosoftTeams

The output of the preceding command can be shown as follows:

There is still some missing functionality for the Teams cmdlets, but you can try to work with them for the basic requirements:

#Showing all cmdlets
Get-Command -Module MicrosoftTeams

#List up all teams with all properties
Get-Team | Select-Object *

#Create new teams
$returnedInformation = New-Team -DisplayName "PowerShell Professionals" -AccessType Private

#Inspecting the cmdlet
Get-Team | Get-Member

#Retrieving the created team
Get-Team | Where-Object {$_.DisplayName -eq "PowerShell Professionals"}
Get-Team | Where-Object {$_.GroupId -eq $returnedInformation.GroupId}

#Making changes to the team
Get-Team | Where-Object {$_.DisplayName -eq "PowerShell Professionals"} | Set-Team -DisplayName 'Changed'
Get-Team | Where-Object {$_.DisplayName -eq "Changed"}

#Adding user to a specific team
Add-TeamUser -GroupId $returnedInformation.GroupId -User '[email protected]' -Role 'Owner'

#Retrieving team users
Get-TeamUser -GroupId $returnedInformation.GroupId

#Remove a team
Remove-Team -GroupId $returnedInformation.GroupId
Remove-Team -GroupId 'f9a51141-ee24-43a7-96c7-f0efb6c6e54a' #GUID
The dedicated documentation for the cmdlets can be found on GitHub:

https://github.com/MicrosoftDocs/office-docs-powershell/tree/master/teams/teams-ps/teams

And the dedicated command reference list for PowerShell for Microsoft Teams can be found at the following link:

https://docs.microsoft.com/en-us/powershell/module/teams/?view=teams-ps
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.247.196