I see alot of customers struggling to get this done, and look to different Powershell GUI’s and unsupported addons – but often see issues when moving to a new server version.
So powershell should be your one-stop-shop for this task.
I therefore decided to publish some of the commands that i use, and please note that the below guides are for DANISH holidays, so adjust the dates accordingly 🙂
For Powershell tips on managing Response Groups in general look to this article:
When you work with the RGS cmd-lets you have to rely on variables.
Set-CsRgsHolidaySetcmdlet provides a way for you to modify an existing holiday set. (For the most part, this means adding holidays to or removing holidays from the set.)
Set-CsRgsHolidaySetis not directly used to make changes to a holiday set. Instead, an object reference is created to an existing holiday set by using the
Get-CsRgsHolidaySetcmdlet. (An object reference is a variable that, in this case, refers to an existing holiday set). Changes to the set are made in memory, then the
Set-CsRgsHolidaySetis used to write those changes to the actual holiday set. If you do not call
Set-CsRgsHolidaySet, then the changes you make will exist in memory only and will disappear as soon as you close Windows PowerShell or delete the object reference.
$a = New-CsRgsHoliday -Name “Nytårsdag” -StartDate “1/1/2018 00:00:00 AM” -EndDate “1/1/2018 12:00:00 PM”
$b = New-CsRgsHoliday -Name “Påske” -StartDate “3/29/2018 00:00:00 AM” -EndDate “4/3/2018 12:00:00 PM”
$c = New-CsRgsHoliday -Name “St Bededag” -StartDate “4/27/2018 00:00:00 AM” -EndDate “4/27/2018 12:00:00 PM”
$d = New-CsRgsHoliday -Name “Kr Himmelfart” -StartDate “5/10/2018 00:00:00 AM” -EndDate “5/10/2018 12:00:00 PM”
$e = New-CsRgsHoliday -Name “Pinse” -StartDate “5/20/2018 00:00:00 AM” -EndDate “5/21/2018 12:00:00 PM”
$f = New-CsRgsHoliday -Name “Grundlovsdag” -StartDate “6/5/2018 00:00:00 AM” -EndDate “6/5/2018 12:00:00 PM”
$g = New-CsRgsHoliday -Name “Julen” -StartDate “12/24/2018 00:00:00 AM” -EndDate “12/26/2018 12:00:00 PM”
The you need to assign theese holidays to a new holiday set
New-CsRgsHolidaySet -Parent “ApplicationServer:poolname.domain.local” -Name “DK 2018” -HolidayList($a,$b,$c,$d,$e,$f,$g,)
Now you have a complete 2018 Danish Holiday Set ready to use in RGS.
So lets say you are in the middle of March and your boss ask you to make sure that holidays are in place for easter, and you already have your 2018 set in place – no problem – here is how to add an additional holiday to an existing set.
First we make a varialbe containing the new holiday, then we extract and modify the Holidaylist from en existing Holiday Set
$x = New-CsRgsHoliday -Name “Påske” -StartDate “3/29/2018 00:00:00 AM” -EndDate “4/3/2018 12:00:00 PM”
Same procedure it you wanted to remove a single holiday from the list – in the example i remove Påske from the DK 2018 set
$x = Get-CsRgsHolidaySet -Identity service:ApplicationServer:poolname.domain.local -Name “DK 2018”
Also worth noting that the opening hours also can be created as sets that will selectable in the Repons Group creation process.
$a = New-csRgsTimeRange -Name “Business Hours” -OpenTime “07:00” -CloseTime “17:00”
New-CsRgsHoursOfBusiness -Parent “ApplicationServer:poolname.domain.local” -Name “Business Hours” -MondayHours1 $a -TuesdayHours1 $a -WednesdayHours1 $a -ThursdayHours1 $a -FridayHours1 $a
Thats it for know, hopefully the task of maintaining your company holidays will be less of a headache now.