Add new dates to Teams holidays using PowerShell

So, here we again – A new year (and new me?) after the last holiday is over it’s time for a new year and that lucky means new holidays in sight, but in order to truly be off duty, you might need to update your holidays in Teams Admin Center (TAC) so that you and other departments that are dependent on a Auto Attendantes can have the voice mail pick of the phone will you take a day off.

To create and manage holidays in Teams we need to either use the TAC web interface, it’s pretty straight forward and you can read more about that here: Set up holidays in Microsoft Teams, we will be using PowerShell to update or create new holidays in TAC.

First of you need the Teams PowerShell module – You can install in PowerShell running the following command in an elevated PowerShell: Install-Module -Name MicrosoftTeams

We will be needing the following commands from the Microsoft Teams PowerShell module:
* Get-CsOnlineSchedule
* Set-CsOnlineSchedule

An importing thing you need to know before reading any further that the code shown below can’t be copy pasted in to your own environment for two simple reasons. One, the naming of your holidays might not be the same as mine and the second reason is that every holiday in every Microsoft Teams tenant have a unique ID.

The ‘simple’ approach
If you are en hurry and only need to update one or two holidays you can use this approach and adjust date range to your needs. You do however need the ID of the holiday you are trying to add a date range to. The ID can be obtained by using this command: Get-CsOnlineSchedule
This command will output every holiday and afterhours schedules in your Teams tenant, all you need to now is to locate the ID of the holiday in the output you wish to add a date range to – See sample below

Samle output of: Get-CsOnlineSchedule

Now your commands will look like this: