Skype for Business – Automatic RGS Holidayset

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-powershell-and-json/

As he mentions in the blogpost, the only source for JSON dates for most countries is sites that cost $$$. I ended up with the same conclusion.

I thought that there should be a way to do this for free. There are several free sites that provide holiday date information, but in “regular” website format. I now remembered that i one time read that PowerShell could catch text from websites. I ended up with officeholidays.com, that have the dates/names in tables. I was able to catch text from the website. But what to do with the text? How do I filter out what’s needed and convert it to a object/variable?

I fired away a question over at Microsoft Tech Community PowerShell forum. It did not take long before I got a reply.
I tested the code I got from the forum with all 133 countries that officeholidays.com have, and ended up with it working for 131 out of 133 countries. With some minor adjustments, I managed to get this data into a usable variable.

Here is the function that does all the data catching magic:

function

As there is no standard for how to mark holidays if its “a day off from work” holiday, you should adjust the script to suit your needs. To filter out some days, you could remove the holiday class you want from the Where-Object command.
Haven’t tested it, but you also probably could remove unwanted days with Jamie Schwinn`s tool: http://waveformation.com/holidayseteditor/
I will take a look to see if i can automate removal of unwanted days later.

The next step will be to see if this can be converted to work with autoatendants in Office 365.

Script can be downloaded from GitHub:
https://github.com/AlexanderHolmeset/Skype-for-Business-Automatic-RGS-Holidayset

Please let me know if you have any feedback/suggestions for the script.

29/7/2017: Found a major bug. Script creates only one new-csrgsholiday.
Needs to be like this: -Holidaylist($a,$b,$c)
Not: -Holidaylist($x)
Working on resolving this as soon as possible.
$x need to be an Array. Will fix script tonight.
Fixed!

Other sources of inspiration:

 

One thought on “Skype for Business – Automatic RGS Holidayset

Leave a comment