Haiku #112

Let's go fly a kite

Up to the – nah, we'd rather

Do holiday sets.

 

This past weekend the author of today's haiku went to see the musical version of Mary Poppins.

 

Note. Don't be surprised: technically they wouldn't let him in the door to see the show. He snuck in the through a window when no one was looking.

 

All in all the show was pretty good: considering that they included all the songs from the original movie, it would be pretty hard for it not to be good. However, in the musical they did sing the songs in a very different order from the movie. Let's Go Fly a Kite coming smack dab in the middle of the show? As a parent, and thus as someone who has seen Mary Poppins several thousand times, that was a little discombobulating.

How discombobulating? Well, imagine this: Suppose we took a typical Lync PowerShell daily haiku, cut out all the paragraphs, then reassembled those paragraphs in random order. You'd end up with sheer nonsense: an article that had no clarity or coherence, an article that seemingly had nothing to do with either haikus or Lync Server PowerShell, an article that –

 

Well, OK: bad example. But you know what we mean.

 

If you, too have seen the movie several thousand times then you no doubt remember the horse racing scene. Mary Poppins wins the race (no surprise, seeing as how she is practically perfect in every way) and is immediately surrounded by reporters. One of the reporters remarks that Mary is probably at a loss for words after her rousing victory, but Mary tells them that she actually has the perfect word for an occasion such as this: CsRgsHolidaySet.

 

Note. OK, granted that might not sound like the perfect word for any occasion. But try singing it in Julie Andrews' voice. Trust us: it’ll sound a lot better.

 

Unlike a common everyday word like supercalifragilisticexpialidocious (which means "something to say when you have nothing to say"), you might not be familiar with CsRgsHolidaySet. As it turns out, CsRgsHolidaySet is the noun used with a family of Lync Server PowerShell cmdlets: Get-CsRgsHolidaySet, New-CsRgsHolidaySet, Remove-CsRgsHolidaySet, and Set-CsRgsHolidaySet. And what does that family of Lync Server PowerShell cmdlets allow you to do? We have no idea.

 

No, wait: just kidding. We know exactly what those cmdlets do: they enable you to manage Response Group holiday sets.

 

And here's an unexpected bonus: we even know what a Response Group holidays set is. Unlike the Lync Server PowerShell blog, which is fully-staffed around the clock 365 days – no, wait 385 days a year! – some organizations actually give their employees a day off every now and then. As for as the Response Group application is concerned, these days off are known as holidays. What difference does it make to the Response Group application if an organization gives everyone a day off every now and then? Well, what happens is this: if you call a number associated with a Response Group workflow, one of the things the Response Group application will do is check to see if today happens to be a holiday. If so, then the system can be configured to do something like automatically transfer the call to voice mail, ensuring that the phone doesn't just ring and ring and ring even though no one is there to answer it.

 

So how do you create one of these holiday sets? Well, for starters, you first need to create a holiday: Lync Server won't let you create a holiday set that doesn't include at least one holiday. (Which makes sense: who needs a holiday set that doesn't contain any holidays?) Here's a sample command that creates a holiday and stores that holiday in the variable $x:

 

$x = New-CsRgsHoliday –Name "Holiday 1" –StartDate "7/12/2011" –EndDate "7/13/2011"

 

Note. If you aren't sure what that command actually does, then you might want to take another peek at haiku No. 73.

 

Yes, that haiku No. 73.

 

As soon as we have a holiday we can then create a holiday set. This particular set is going to be used for our help desk: we're going to give those folks July 12th off. Needless to say, different groups in your organization might have different holidays: although the help desk gets July 12th off, maybe the customer support people don't. And that's fine: assuming that each of these groups has its own Response Group workflow all you have to do is create separate holiday sets for each one.

 

But we digress. Here's a command that creates a new holiday set and adds the holiday we stored in $x to that set:

 

New-CsRgsHolidaySet -Parent "service:ApplicationServer:atl-cs-001.litwareinc.com" -Name "Help Desk Holidays" -HolidayList($x)

 

See? Nothing to it. We created a new holiday set named Help Desk Holidays, and added a single holiday to it. What if we wanted to add multiple holidays to that holiday set? That's fine. All we'd have to do is create another holiday, storing that holiday in a different variable:

 

$y = New-CsRgsHoliday –Name "Holiday 2" –StartDate "12/19/2011" –EndDate "12/20/2011"

 

And then we can add both holidays using the same command:

 

New-CsRgsHolidaySet -Parent "service:ApplicationServer:atl-cs-001.litwareinc.com" -Name "Help Desk Holidays" -HolidayList($x,$y)

 

Or, if we created a bunch of holidays, we could add a bunch of holidays with a single command:

 

New-CsRgsHolidaySet -Parent "service:ApplicationServer:atl-cs-001.litwareinc.com" -Name "Help Desk Holidays" -HolidayList($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k)

 

And yes: we'd like to work for a company that gave employees that many days off, too.

 

Pretty cool, huh? Now, suppose we decide to add a new holiday to an existing holiday set; how do we do that? Admittedly, it's a little tricky, but this will work:

 

$z = New-CsRgsHoliday –Name "Holiday 3" –StartDate "12/18/2011" –EndDate "12/19/2011"

 

$holidaySet = Get-CsRgsHolidaySet –Name "Help Desk Holidays"

$holidaySet.HolidayList.Add($z)

 

Set-CsRgsHolidaySet –Instance $holidaySet

 

So what all did we do here? Well, for starters, we created our third holiday and stored it in the variable $z. We then used this command to retrieve an object reference to our holiday set, storing that object reference in a variable named $holidaySet:

 

$holidaySet = Get-CsRgsHolidaySet –Name "Help Desk Holidays"

 

After that we used the Add method to add the holiday $z to the set, and then, last but surely not least, used the Set-CsRgsHolidaySet cmdlet to write those changes back to the Response Group application.

 

A little goofy, but it works.

 

We can also use a somewhat similar approach to remove a holiday (in this case, Holiday 3) from an existing set:

 

$holidaySet = Get-CsRgsHolidaySet –Name "Help Desk Holidays"

$holidaySet.HolidayList.Remove("Holiday 3")

 

Set-CsRgsHolidaySet –Instance $holidaySet

 

And if Ebenezer Scrooge ever buys out your company you can use a command like this one to remove all the holidays from a holiday set:

 

$holidaySet = Get-CsRgsHolidaySet –Name "Help Desk Holidays"

$holidaySet.HolidayList.Clear()

 

Set-CsRgsHolidaySet –Instance $holidaySet

 

You know, that's what we said: Bah! Humbug.

 

As you might expect, you can always use Remove-CsRgsHolidaySet to completely remove a holiday set, or use Get-CsRgsHolidaySet to return information about your existing holiday sets. In fact, here's an interesting command. You say you want to know if any of your holiday sets still show December 18th as a holiday? Here's a way to return the names of any holiday set that includes 12/18/2011 as a holiday:

 

 Get-CsRgsHolidaySet | Select-Object Identity -ExpandProperty HolidayList | Where-Object {$_.StartDate -match "12/18/2011"} | ForEach-Object {Get-CsRgsHolidaySet -Identity $_.Identity} | Select-Object Name

 

By the way, there's one tricky little thing we uncovered by accident when playing around with this cmdlet. (At least when working with a US English system.) Suppose you want to know if there are any holiday sets that include 12/8 as a holiday. Believe it or not, this command won't return any date (note the highlighted text):

 

 Get-CsRgsHolidaySet | Select-Object Identity -ExpandProperty HolidayList | Where-Object  {$_.StartDate -match "12/8/2011"}  | ForEach-Object {Get-CsRgsHolidaySet -Identity $_.Identity} | Select-Object Name

 

Instead, you need to specify a date like 12/8/2011 this like:

 

12/08/2011

 

In other words:

 

 Get-CsRgsHolidaySet | Select-Object Identity -ExpandProperty HolidayList | Where-Object  {$_.StartDate -match "12/08/2011"}  | ForEach-Object {Get-CsRgsHolidaySet -Identity $_.Identity} | Select-Object Name

 

And what if you had a date like 1/8/2011? That needs to be formatted like this:

 

1/08/2011

 

In other words, you need to put a leading zero before a single-digit day, but you don't have to preface the month with a leading zero. Why not? About all we can say is this: supercalifragilisticexpialidocious.

 

Which is what you say when you have nothing else to say.