Holiday Sets and the Workflows that Love Them

by Christopher Wallick, BT


There’s so much to consider when thinking about the varied and sundry PowerShell cmdlets that are used to manage and configure Microsoft Lync Server 2010. In this riveting installment of “A Snippet from the Shell” we’ll look into the seedy world of the Response Group application and see how, with a few quick lines, we can create a custom “Holiday Set”. (Okay, it’s not that seedy – or even all that riveting for that matter – but I had to grab your attention somehow and I didn’t want to resort to using words like “futterwacken”, “vorpal”, or “Jabberwocky”. )


At a very high level the Response Group application is a mechanism by which Lync Server 2010 routes incoming calls to a preselected group of “agents” by using a “hunt group” or an “Interactive Voice Response (IVR)”. That’s a lot of quotation marks! I use them here to underscore that there may be some Lync terminology that may be new to some of you and, quite frankly, may be used differently from how others of you are used to. The way these response group components fit together is a topic for another article entirely, but for today I thought it would be useful to take a closer look at the creation of a holiday set.


As many of you may know a holiday set is nothing more than a predefined list of public holidays when the business will be closed. This is different from defining regular business hours. As you go through building a response group workflow you will see there are many different configurable settings around how to treat an incoming call based on the time of day, the day of the week, and as we’ll see here, the day of the year.


By default there are no predefined holiday sets listed in the RGS Configuration tool. So how does one go about adding a holiday set? That’s a great question and I’m glad you asked. The first thing to note is you can’t do it in the Lync Server Control Panel nor within the RGS Configuration tool. It can only be done in PowerShell.


So, here’s where we boldly go to the Lync Server Management Shell. Ready? Great! The first thing to remember when writing a PowerShell script is that PowerShell executes each line of code in order. If this is a bit confusing don’t worry, it’ll all make sense soon. The holiday set itself is a kind of logical container that contains information about individual holidays. All of the holidays together make the holiday list property which is then referenced by the holiday set. Still with me? Well, stick with it and all will become clear in a minute.


For the sake of example let us consider the federal holidays observed by the U.S. for our first holiday set. In the U.S. the first federally observed holiday is New Year’s Day. The next is Martin Luther King Day, then President’s Day and so on. The first thing we’ll create in our script will be the holidays themselves. We’ll assign each holiday a variable that we’ll call later.


$a = New-CsRgsHoliday –Name "New Year Days" -StartDate "01/01/2011" -EndDate "01/02/2011"

$b = New-CsRgsHoliday –Name "Martin Luther King Day" -StartDate "01/17/2011" -EndDate "01/18/2011"

$c = New-CsRgsHoliday –Name "Presidents Day" -StartDate "02/21/2011" -EndDate "02/22/2011"


Here you can see we use the New-CsRgsHoliday cmdlet to create the holiday with the appropriate values for Name, StartDate, and EndDate.


Once created, we’ll then need to create the holiday set by using the New-CsRgsHolidaySet cmdlet.


New-CsRgsHolidaySet $ser -Name "US_HolidaySet" -HolidayList($a, $b, $c, $d)


Here we see a variable, $ser, after the New-CsRgsHolidaySet cmdlet. So, what’s that all about? This references the -Parent switch that sets the identity or service to which this holiday set will be applied. In this instance I’ve associated this information with a variable ($ser) rather than type out the long string referencing the response group service identity.


Once done, you’ll be able to see the new holiday set exposed in the RGSConfig tool. How cool is that?! I know; very cool, right? Wait a second though! What if, like me, you’ve made a mistake or forgot to include a particular holiday? What do you do then? If your answer was to light your hair on fire and run down the hall screaming you’d be wrong. The correct answer is that you’ll need to simply rebuild the holiday list property and then use a Set cmdlet to upload the changes. Given that the holiday set has already been created we’ll use the Get-CsRgsHolidaySet cmdlet and assign the result to a variable.


$hs = Get-CsRgsHolidaySet $ser -Name "US_HolidaySet"


Then we’ll use the Remove method to delete all holidays from the holiday list.




Now remember this is happening all in local memory and hasn’t actually been applied yet. Next we’ll repopulate the holiday list with the complete list of holidays by using the following string:


$hs.HolidayList = ($a, $b, $c, $d, $e)


Now we’ll use Set-CsRgsHolidaySet to upload the changes.


Set-CsRgsHolidaySet $hs


Clear as mud? Awesome! I hope this helps and until next time happy shelling!


See more Snippets from the Shell


Comments (2)
  1. jim says:

    Helpful article for getting me started! Don't mean to throw rocks. Thanks for publishing it.

  2. KahSky says:


    Great article!

    I'm actually looking if there is some way to assign the new holidayset to a specific workflow by using command line, but it seems not possible so far. Did you tried this as well?


Comments are closed.

Skip to main content