Screenshot 2018-11-07 at 13.59.55.pngNew Console, New Module

Given that the Teams and Skype for Business Online Admin Center recently introduced support for team management, it is unsurprising that Microsoft has refreshed the Teams PowerShell module. You can now download version 0.9.5 from the PowerShell Gallery).

In terms of the administrative control over Teams, the module has improved steadily from the first release and is now capable of handling most of the administrative operations available in the Teams and Skype for Business Online Admin Center. Cmdlets are available to create teams (including a team for an existing Office 365 group), list all teams in the tenant, update settings for teams, and create new channels. Because the module is still evolving, some change is inevitable before the final release. Even with this warning, you can depend on the current release for production use.

Download from the Gallery

Before you can use the Teams module, you must download it from the PowerShell gallery and then install the module on your PC. To update to the latest release, use PowerShell with administrator permissions and run the following commands to remove the previous version and download and install the latest module.

Uninstall-Module -Name MicrosoftTeams
Install-Module -Name MicrosoftTeams -Repository PSGallery

 

If you haven’t ever installed the module, you naturally don’t need to remove it.

After installing the module, you run the Connect-MicrosoftTeams cmdlet to connect to the Teams service.

Get-Team is Useful

Up to 0.9.5, the Get-Team cmdlet suffered from the severe restriction of only being able to return a set of teams that the logged-in user was a member of. This is a problem because administrators often want to work with teams that they don’t belong to. Now, if you run Get-Team without any parameters, it returns the full set of teams in the tenant.

Apart from being more convenient, Get-Team is much faster at retrieving a list of teams than any other method such as running Get-UnifiedGroup and then trying to figure out what Office 365 Groups are team-enabled.

If you want to retrieve a list of teams that the currently logged-in user belongs to, pass their User Principal Name via the User parameter:

Get-Team -User user.abcd@users.com

Simple Output

Get-Team is fast, but it is a very simple cmdlet that returns just three values for a team:

  • Group identifier.
  • Display Name.
  • Description.

The group identifier is the most important value. It is a GUID that uniquely identifies a team and is used as the input to most of the other cmdlets in the Teams module. For example, to add a new member to a team, we run the Add-TeamUsercmdlet and pass the group identifier and the User Principal Name for the new member:

 

No Filters

The Get-Team cmdlet does not include a Filter parameter to select a subset of teams, probably because the cmdlet returns such a limited set of properties. However, you can trade some of the performance by applying a client-side filter to the display name or description properties to find specific teams. For example:

Get-Team | ? {$_.DisplayName -Like “*Office*”} | Format-Table DisplayName, Description

We can combine a filtered lookup for a specific team to return its identifier and use that value to fetch information from Azure Active Directory or the Office 365 group:

$Group = (Get-Team | ? {$_.DisplayName -eq “O365Users”} | Select GroupIdGet-UnifiedGroup -Identity $Group.GroupId

The lack of good filtering for Get-Team doesn’t matter so much when your tenant only has a few hundred teams. It becomes more of an issue as the number of teams increases. It would be nice if Microsoft supported server-side filtering for the cmdlet – and added a few extra properties to use with filtering. For example, to select teams managed by a certain person, or those with guest users, or those marked with a specific classification.

Good Progress, But More to Do

It’s good to see the Teams PowerShell module make progress and we can expect further updates as the module makes its way to generally available status. What’s not so good is that the full spectrum of Teams management through PowerShell is split across three modules: Exchange Online, Skype for Business Online, and Teams. This is because different engineering groups are responsible for each module and it’s unlikely that this situation will change in the short term. With that in mind, it would sure be nice if a connection to any of these modules offered the option to bring in the other modules.

 

 

 

Courtesey of Petri Tony Redmond

Leave a Reply