Haiku #73

Every day can be a

Holiday, as long as you

Use the right command.

Well, today is Wednesday, often referred to as "Hump Day" here in the U.S., referring to the fact that Wednesday falls smack dab in the middle of the workweek. In theory, if you can get over the hump (that is, if you can get through Wednesday) then the rest of the week should be a piece of cake; after all, at that point the week's practically over.

That's the theory anyway.

At any rate, this has been an especially … interesting … Wednesday; right now it's 9:25 AM Pacific Daylight Time and we're only about three paragraphs into an article that typically gets published around 9:00 AM Pacific time. What does that mean? That means we need to quit fooling around and get to work.

Note. But first we really must point out that Wednesday is named after the Norse god Odin, also known as Woden. In other words, Woden's Day equals Wednesday. Similarly, Thursday is named after the Norse god Thor (Thor's Day); Friday after the Norse goddess Freya (Freya's Day); and Tuesday after the American actress Tuesday Weld.

Well, we assume that Tuesday is named after Tuesday Weld. We didn't really have time to do a lot of research for today's article.

Although Wednesday is often referred to as Hump Day, it turns out that Hump Day is not an official holiday, at least not in the U.S. (Of course, the U.S. is somewhat unique in that we don't have any official holidays. Even General Pulaski Memorial Day is just a day of recognition, not an actual national holiday.) But that's one of the great things about the Response Group application: it lets you turn any day into a holiday. And to do that, all you have to do is know how to use the New-CsRgsHoliday cmdlet.

We should probably note that, as far as the Response Group application is concerned, a holiday is simply a day when you would expect people to be working but, for whatever reason, they aren't. For example, suppose your building is going to be closed next Wednesday while they upgrade the plumbing. Not really a day for joyous celebration (well, depending on just how badly the plumbing needs upgrading) but a day when you would typically be at work. Because you won't be at work, you need to configure the Response Group application to act accordingly if someone calls next Wednesday; for example, instead of just letting the phone ring and ring and ring (even though no is there to answer it) you might want to have any calls automatically transferred to voice mail.

In order to do that, you need to configure next Wednesday (March 30, 2011) as a holiday. And how do you do that? Here's one way:

$holiday = New-CsRgsHoliday –Name "Plumbing Replacement Day" –StartDate "3/30/2011" –EndDate "3/31/2011"

What have we done here? Well, we simply called the New-CsRgsHoliday cmdlet, passing it three parameters:

· Name. As you might have guessed, this is simply the name of the holiday. You can name this holiday anything you want; just make sure that the name is unique among your holidays. For example, if you already have a holiday named Plumbing Replacement Day then you'll need to call this something like Plumbing Replacement Day II.

· StartDate. The date and time that the holiday begins. You might have noticed that we didn't actually include a time here; in that case, that means the holiday officially starts at midnight (12:00:00 AM). What if we didn't want the holiday to start until 3:00 PM? Well, using the date-time syntax for US English, we could configure the start date like this:

-StartDate "03/30/2011 3:00 PM"

Alternatively, we can use the 24-hour clock format, in which 3:00 PM is equivalent to 15:00.

-StartDate "03/30/2011 15:00"

· EndDate. The date and time that the holiday ends. The end date uses the same syntax as the start date. That means that, because we didn't specify a time, the holiday will end at 12:00 AM on March 31, 2011. Which, in turn means that the holiday will start at midnight on March 30, run through 11:59:59 PM on that same day and then, as the clock strikes midnight on March 31st, come to an end.

Yes, pretty much like Cinderella.

You might have noticed that we also configured our command so that the resulting holiday is stored in a variable named $holiday. Why did we do that? Well, the Response Group application doesn't allow you to create "free range" holidays; instead, every holiday we create must be tied to a holiday set (a collection of holidays). If we didn't store Plumbing Replacement Day in a variable, then the holiday would be created and then instantly vanish the moment we finished running our command.

Note. Which, now that we think about it, is the way most holidays seem to work: no sooner do they start then they come to an end and you have to go back to work again.

So how do you add a holiday to a holiday set? Well, here's one example:

$holiday = New-CsRgsHoliday –Name "Plumbing Replacement Day" –StartDate "3/30/2011" –EndDate "3/31/2011"

$y = Get-CsRgsHolidaySet -Identity "service:ApplicationServer:atl-cs-001.litwareinc.com" -Name "2011 Redmond Holidays"

$y.HolidayList.Add($holiday)

Set-CsRgsHolidaySet -Instance $y

As you can see, what we've done here is first create our new holiday and stash it in the variable $holiday. We then use the Get-CsRgsHolidaySet cmdlet to retrieve an instance of the holiday set (a set we created previously) named 2011 Redmond Holidays. We then use this command to add Plumbing Replacement Day to the holiday set:

$y.HolidayList.Add($holiday)

So is that all we have to do? Well, not quite. Right now our modified holiday set exists only in memory; if we were to terminate our Windows PowerShell session right now Plumbing Replacement Day would never get added to the real holiday set. In order to actually save the change we just made, we need to use this line of code:

Set-CsRgsHolidaySet -Instance $y

At that point, you can break out the party hats and noisemakers, because Plumbing Replacement Day is now an official Response Group holiday.

That's pretty much all there is to it. Happy Hump Day everyone and we'll see you tomorrow.

Note. Which, despite being the birthdate of Samuel Ashe, the ninth governor of North Carolina, and of Steve Ballmer, Microsoft CEO, is not an official holiday either. We don't understand it, either. And before you ask, no, Steve doesn't give Microsoft employees his birthday off.

He does, however, make us all bring him expensive presents and bake him a cake. And if he doesn't like your cake, then you're fired on the spot.

Note. No, not really. However, all 50,000 of us here on the Redmond campus are required to gather in his office and sing Happy Birthday.

Note. No, not really. Even Steve's office isn't that big.

Well, not that we've ever actually been invited to Steve's office. But we assume it's not that big.