Automatic Australian Holiday Rulesets for Response Group Service

New-CSRgsAustralianHolidayList.ps1

Update 6/01/2019 Released Version 3.0 rebuilt to use a new data source for 2020

About the tool

This is a script that adds/maintains the relevant Australian Holidays to your Skype4B  / Lync environment based on data available from the Australian Government Website.

I re-wrote most of the script from scratch and added a whole bunch of code to try and catch a lot of the errors etc that happened in the older versions. I’ve also tried to make it a lot simpler to use for everyone that’s not me 🙂

Data is taken from https://data.gov.au/data/dataset/b1bc6077-dadd-4f61-9f8c-002ab2cdff10 and I have done my best to be as error-free as possible.

Shout of to Greig in Sydney for beta testing and providing the red pen. That guy would have made a brilliant English teacher.

Demo

Instructions

Download, and run on a FrontEnd or any machine with the Lync / Skype4B management tools installed

If you don’t have Internet access on your FrontEnd, run the script with the -DownloadOnly flag and it will download all the required files. Copy these to the FrontEnd along with the script for an Internet free install

The script will attempt to detect your Skype4B Setup and proceed accordingly

  • If it only detects a single FrontEnd it will prompt you to confirm the selected pool and then configure new Holiday sets
  • Should it detect multiple pools it will ask you to confirm which pool to use and configure new Holiday sets
  • If it finds Holiday sets with the same name they will automatically have any existing entries removed and replaced

If you already have holiday sets with the name names or you need to add a country code. You can specify a string with the -RGSPrepend parameter to prepend to the Holiday set names.

Unattended (Scheduled Task) execution

You can also use the script on a scheduled task to automatically pull and update the latest holidays on a monthly basis if your server has internet access.
Simply specify -FrontEndPool <FEPoolFQDN> and -Unattended in the scheduled task.

Note this option will disable script update checking. So it pays to check manually every now and again.

Applying the Holiday sets

After you have run the script, you can find the time frames in the Response Groups Editor, Simply tick the states you want the workflow closed for.
Each of the states already includes the National holiday set, so there is no need to tick both.
I’ve also added a new reminder feature showing when the script was last run in the RGS editor.

Download

You can grab it from the TechNet Gallery here

Fork Me

As a lot of my code is open source, I’ve moved from storing my Git repo on VSTS over to GitHub. Feel free to fork the code for your own purposes over here

Advanced

The default holiday set names are “National”,”Victoria”,”New South Wales”,”Queensland”,”ACT”,”Northern Territory”,”South Australia”,”Western Australia”,”Tasmania”
If you need to change these for whatever reason update the following lines in the script (You will need to remove the digital signature for this to work)

1
<br> $National = $RGSPrepend+"National"<br> $Vic = $RGSPrepend+"Victoria"<br> $NSW = $RGSPrepend+"New South Wales"<br> $QLD = $RGSPrepend+"Queensland"<br> $ACT = $RGSPrepend+"ACT"<br> $NT = $RGSPrepend+"Northern Territory"<br> $SA = $RGSPrepend+"South Australia"<br> $WA = $RGSPrepend+"Western Australia"<br> $Tas = $RGSPrepend+"Tasmania"

Version History

:v3.0: The ScoMo holiday build 6/01/2020

ScoMo takes a holiday and so does the XML data I was using to get accurate dates
Updated, Changed to data.gov.au Datasource. A lot of rewriting
Updated, Functions replaced with newer versions
Added, Script has been signed, so you know what your running hasn’t been fiddled with. Thanks, DigiCert!
Added, Script now outputs the last date it ingested in proper region format
Added, non-domain joined detection
Added, Year tagging to Holiday names
Added, Better logging messages for writing to the database, esp when an FE is offline
Fixed, Script would always put the date 5/11/2018 in one of the last run place holders, now correctly uses ShortDate
Fixed, Sorted a bug with unattended mode not updating the last run flag

:v2.30: The Feedback Build 5/11/2018

Update Released Version 2.3
Added display of dates to logs
Added a notification at the end of the script showing the last imported date.
Added last run date
Added RGS Update Time Stamp
Added Error handing for 0 FrontEnds
Fixed a bug with 1 FrontEnd Pools throwing errors when updating existing holidays

Update 19/05/2018 Released Version 2.2
Fixed a bug with logging system culture
Removed some old redundant code
Passed script through ISESteriods PSSharper and applied corrections
Fixed a few typos
Fixed a few bugs introduced cleaning up my dodgy code
Fixed a bug with multiple pools using the same holiday set names
Deprecated the ServiceID parameter, Specify the pool FQDN instead
Added warning for deprecated ServiceID
Updated Pat Richard’s website
Removed PowerShell 5.1 cmdlet (Get-Timezone), now using a WMI query instead

Update 11/05/2018 Released Version 2.1 with TLS 1.2 support
Added Script logging
Updated to use my new autoupdate code
Added ability to switch between devel/master branches
Added timezone offset detection / warning
Added TLS 1.2 support for the new Govt website requirements

Update 09/10/2017 Released Version 2.0 with a Massive Overhaul, updated for 2018!
Added Autodetecton of single RGS pool : Added Autodetecton of single RGS pool
Complete Rewrite of existing rule rewrite code , Should make for alot less red text!
More User friendly and better instructions
Fixed a few typo’s causing dates to be incorrect.
You no longer need to “Reassign” the holiday sets to response groups anymore.

Update 2/11/2016: Released Version 1.1 of the script. Fixed Onedrive download link

Fix for Typo in Victora Holiday set causing import to fail
Fix ForEach loop not correctly removing old time frames
Fix Documentation not including the SID for ServiceID parameter

Update 26/09/2016: Fixed some Typo’s. Thanks Grieg

14 thoughts on “Automatic Australian Holiday Rulesets for Response Group Service

  1. Pingback: Announcement: New version of my Australian Response Group Holiday Rules, Now fully automatic every year! | Skype4BAdmin.com

  2. Corey

    I really like this one, however it seems that the Linux DateTime is the wrong in the XML

    Easter Friday for Australia, the RawDate in the XML is 1522328400

    PS H:\> $udate = get-date “1/1/1970”
    PS H:\> $start = ($udate.AddSeconds(1522328400).ToLocalTime() | Get-Date -Format dd/MM/yyy)
    PS H:\> echo $start

    returns a Start Date of 29-03-2018 Which is the day before Easter Friday

    I have changed the following lines to fix it

    Line 527-537

    $udate = get-date “1/1/1970”
    if ($ConvertTime) {
    #American Date format
    $StartDate = ($Udate.AddSeconds(([int]$event.rawDate+86400)).ToLocalTime() | get-date -Format MM/dd/yyyy)
    $EndDate = ($Udate.AddSeconds(([int]$event.rawDate+172800)).ToLocalTime() | get-date -Format MM/dd/yyyy)
    }
    else {
    #Aussie Date format
    $Startdate = ($Udate.AddSeconds(([int]$event.rawDate+86400)).ToLocalTime() | get-date -Format dd/MM/yyyy)
    $EndDate = ($Udate.AddSeconds(([int]$event.rawDate+172800)).ToLocalTime() | get-date -Format dd/MM/yyyy)
    }

    Reply
    1. Avatar photoJames Arber Post author

      Government department getting date formats wrong? never! Let me have a look.
      Edit, the date in the XML is correct.
      Time Conversion

      Correct Timestamp

      Also seems to work fine from my machine.
      Can you raise an issue on GitHub so I can try this?
      Also what’s the output of get-culture and get-timezone from your server/management box

      Reply
      1. Corey

        Yep, the problem is that it is returning the UTC date. It needs to add the timezone offeset for this to work properly

        Reply
  3. Avatar photoJames Arber Post author

    That’s a powershell function (.tolocaltime) which suggests your timezone or culture is set incorrectly.
    Many of my customers use this script and I haven’t had any reported incidents yet, but its something I’m looking at catching in future.

    Did you have any luck with the get-timezone or get-culture?

    Reply
  4. Jeremy D

    Hi James,

    its it possilbe to exclude holiday types – ie bank holiday, so that holidays that dont apply arent added

    Reply
    1. Avatar photoJames "UcMadScientist" Arber Post author

      Hmm,, not at present. But I could probably whip something up. Realistically it depends on the data source. I could probably add an exclusion filter in the next release.

      Reply
      1. Jeremy D

        Hi James,

        looking at the aus data source.

        you could have an exclude filter for HolidayName more than happy to assist with this

        Reply
      2. Jeremy D

        Hi James,

        looking at the aus data source for holidays.

        you could have an exclude filter for HolidayName more than happy to assist with this

        Reply
        1. Avatar photoJames "UcMadScientist" Arber Post author

          I should be able to get to it soon (a week or two), otherwise feel free to submit a PR and I’ll take a look 🙂

          Reply

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.