In the first blog post in this series we covered a lot of basic information about what can be done with a pair of cmdlets: Get-Team and Set-Team. These two cmdlets provided a good basic understanding of some team functions. Now there are plenty of other cmdlets for Teams so for this blog article we will look at how to create and remove Teams.
Adding a New Team
Create a Microsoft Team can be as simple or as complex as we want it to be. If we look at the examples, we see that a new Team does not have too many required properties:
A Team can be created with just specifying the new Team’s Display Name:
Not very imaginative, but it gets the job done. What other options do we have when we create a new Team? We can review the Syntax to see a lot of the options that are available in the creation of a Team:
** Note ** That the Synopsis of the cmdlet also reveals more about what happens in the background when a Team is created:
If we review the parameters that are available, we see that there are a few options for when we create the Team. As was noted before, most if not all of them are options. We covered all of these options in the first blog post. Here they are for reference:
So instead of setting these values after a group was created, we can instead set these when the Team is created. The advantage to this is that we could have a standard configuration that is set at this time. Here is an example[/sourcecode] of this.
# Set variabled values: $Teams = 'Project - Mail Server Upgrade','Project - HR System Upgrade','Project - Phone System Upgrade' $AllowCreateUpdateChannels = $False $AllowDeleteChannels = $False $AllowUserEditMessages = $False $AllowUserDeleteMessages = $False # Create all Teams Foreach ($Team in $Teams { New-Team -DisplayName $Team -AllowCreateUpdateChannels $AllowCreateUpdateChannels -AllowDeleteChannels AllowDeleteChannels -AllowUserEditMessages $AllowUserEditMessages-AllowUserDeleteMessages $AllowUserDeleteMessages }
The above code would then create a standard configuration for these Teams when the Team is created.
Removing a Team
If we no longer need a Microsoft Team and would like to delete it from a tenant, we simply need the GroupID which we then reference from the Remove-Team cmdlet. For example let’s review our list of teams to make sure we grab the correct GroupID:
We then take the GroupID and feed it to Get-Team to make sure this is the team before removing it:
Taking the one-liner we can then pipe it to Remove-Team like so:
We see that there is not warning that we are removing a team. BE CAREFUL!
In the next blog post [003] we will cover how to work with Team Channels. Look for this to come out next week!