Microsoft Teams and PowerShell (part 2)
In part 1 we cover the basic options with Microsoft Teams PowerShell and start from getting the module, show the commands and other group options.
In part 2 we see how we can take the PowerShell for Microsoft Teams on level up.
Why do we need to load the AzureAD module with MicrosoftTeams? the reason is to work with group names and not groupid and actually its the display name based on groupid. So the recommendations are to connect both AzureAD with MicrosoftTeams.
Group, Channels and other settings
First things first we need to connect to MicrosoftTeams and AzureAD services
$cred = Get-Credential
Connect-MicrosoftTeams –Credential $cred
Connect-AzureAD -Credential $cred
Once we connected we can play with the commands, to work with Teams we’ve few commands, *-teams, for example:
Get-Command *get-team*
then we need to know who is our teams and groups, so we can type:
Get-Team
Some of my teams are configured as need and some of them not, so how we can know what inside of it, but no matter only with the Get-Team commands we cannot receive useful information for our Team even if we run Get-Team |fl, so we must add more command from MicrosoftTeams module itself and from AzureAD module.
First, we need to run the simple command to know which value is available for us
Get-AzureADGroup | fl or Get-AzureADGroup | gm
then we can take the Group ID from GetTeam and run with AzureAD group object with the following command:
Get-AzureADGroup -ObjectId 0a03c13c-e54d-4274-9092-3f2d49fea27a|fl
and now we’ve useful information to work with and one of the examples is to change values such in the following command:
Get-AzureADGroup -ObjectId 0a03c13c-e54d-4274-9092-3f2d49fea27a|Set-AzureADGroup -Description “Teams LAB01 and Private” -MailNickName TeamsLAB01
-SecurityEnabled $True
for example, to change display name with Teams command we can do the following action:
Set-TeamChannel -GroupId 0a03c13c-e54d-4274-9092-3f2d49fea27a -NewDisplayName TeamsLAB01 -CurrentDisplayName General –Verbose
In the next part, we play with other settings such: TeamFunSettings, TeamMemberSettings, and others.
Thank you so much for the great article, it was fluent and to the point. Cheers.