Skype for Business – Automatically set RGS Holiday Sets with PowerShell and JSON

Every Lync/Skype admin has the same nightmare with Response Group Holiday sets, something that has to manually be programmed each year for Public Holidays in your country.  What if you could script populating Holiday Sets automatically using PowerShell and an API?

I live in England and most of my customers are UK based so I needed a service that would give me Public Holidays for the UK.   Our government website lists all Public Holidays here: https://www.gov.uk/bank-holidays.  They are also conveniently provided in JSON format here: https://www.gov.uk/bank-holidays.json

I did look for a global service, but the one I found wanted $$$ to provide future Public Holidays: https://holidayapi.com/.   This script is based on the GOV.UK website and UK bank holidays, but you could amend it to work with another JSON provider.  Please also test in a Lab before rolling out to your live environment.

We can get the Public Holidays with PowerShell using Invoke-RestMethod:

In this example I only want “england-and-wales” events which can be done as follows:

We can also disregard any Public Holidays that occurred in the past with an If statement:

Now you have the basics of getting Public Holidays with JSON and PowerShell, you can now wrap this up into a PowerShell script that runs the New-CsRgsHoliday and Set-CsRgsHolidaySet cmdlets.  This can be ran as a scheduled task, maybe once a month is appropriate?

Set PoolName and HolidaySetName.

Output from final Get-CsRgsHolidaySet command

 

England and Wales Bank Holidays now show in the Response Group Configuration Portal and should always be up to date.  Again, test in a lab first.

 

Author: Chris Hayward

Share This Post On

Trackbacks/Pingbacks

  1. Skype for Business – Automatically set RGS Holiday Sets with PowerShell and JSON | Chris Hayward.co.uk – JC's Blog-O-Gibberish - […] http://chrishayward.co.uk/2017/07/07/skype-for-business-automatically-set-rgs-holiday-sets-with-powe… […]
  2. Skype for Business – Automatic RGS Holidayset | skype4bworld - […] The inspiration for this script came from Chris Hayward´s blogpost/script for creating holiday sets from a JSON source: http://chrishayward.co.uk/2017/07/07/skype-for-business-automatically-set-rgs-holiday-sets-with-powe……

Submit a Comment

Your email address will not be published. Required fields are marked *