WindowsService: It's

Better than a toaster or

A set of towels.

 

We thought we should give everyone advance notice that we might not be publishing many haikus during the month of April. April, of course, is the month when Prince William of England will marry Kate Middleton, and now that the wedding invitations have been sent out we need to start getting ready for the royal wedding. For example, the author of today's haiku not only has to figure out what a "long coat" or a "morning coat" actually is, but then he has to buy one before the wedding.

 

Hopefully Target has a good selection of morning coats.

 

Note. To be honest, no, we haven't actually received an invitation to the wedding. But let's be real here: we're the authors of the Lync Server PowerShell blog. How could they not invite us to the wedding?

 

In addition to worrying about what to wear to the wedding, we also had to do some thinking about a present for the bride and groom. A toaster was the obvious choice; we were even willing to spend a little extra and get one of those four-slice models that can also toast bagels. But then we started to worry a little bit about that. After all, William and Kate sent out some 1,900 invitations; they're probably going to get scores of toasters. And if someone buys them a Dualit toaster, well, the one we picked out is going to look pretty lame, even if it can toast bagels.

 

Note. In typing up this article, we originally typed that last sentence (with a little help from Word's AutoCorrect feature) as "… even if it can toast beagles." We were tempted to leave it as-is, but we decided to play it safe and change it to bagels.

 

And so the author thought, "If I was getting married [Note: Something his wife would probably be in favor of] what would I want more than anything else in the world?" That's when he came up with the perfect wedding gift: the CsWindowsService cmdlets (Get-CsWindowsService, Start-CsWindowsService, and Stop-CsWindowsService).

 

Admittedly, the CsWindowsService cmdlets aren’t a set of monogrammed towels; instead, they're way better than a set of monogrammed towels. Towels are nice if you happen to be soaking wet, but most of the time we're not soaking wet. (Yes, even those of us who live in rainy Seattle.) But you always want to know the status of your Lync Server services, and you always want to be able to start and stop those services as needed. Most towels can't do that; the CsWindowsService cmdlets can.

 

Take Get-CsWindowsService, for example. As we all know (or at least as we all know now), many Lync Server components run under a Windows service; for example, the Conferencing Attendant runs under the RTCCAA service. To retrieve information about the RTCCAA service you can simply run a command like this one:

 

Get-CsWindowsService –Name RTCCAA

 

In turn, Get-CsWindowsService will display information similar to this:

 

Status    Name            ActivityLevel

------    ----            -------------

Running   rtccaa          Concurrent Calls=8

 

Nice, huh? After all, it not only tells you that the service is running, but it also gives you a quick look at what the service is doing: as you can see, our Conferencing Attendant is currently handling 8 calls.

 

And, of course, you can retrieve this same kind of information for all your Lync Server services simply by leaving off the Name parameter:

 

Get-CsWindowsService

 

What's that? You'd rather retrieve this information for a remote computer? Well, then why didn't you say so? All you need to do is add the –ComputerName parameter, like so:

 

Get-CsWindowsService –ComputerName atl-cs-001.litwareinc.com

 

Of course, you might be wondering, "Couldn't I just do this with PowerShell's Get-Service cmdlet? Wouldn't that be easier?" The answer, to both these questions, is this: no. Yes, you can use the Get-Service cmdlet to return generic service information for your Lync Server services; however, that generic information will not include the ActivityLevel. And no, this would not be easier. Why not? Because Get-CsWindowsService is designed to retrieve information only for the Lync Server services. You don't have to worry about trying to filter out all your other Windows services from the returned data; Get-CsWindowsService does that for you.

 

Note. We should also mention that you can get back a ton of information for a service by running a command like this one:

 

Get-CsWindowsService –Name RTCCAA | Select-Object *

 

Give it a try and you'll see what we mean.

 

Meanwhile, the Start-CsWindowsService and Stop-CsWindowsService cmdlets make it easy to start and stop your Lync Server services. (Probably not something you'll do very often, but this definitely does make it easier when you need to.) The Stop-CsWindowsService cmdlet is especially nice because of the Graceful parameter. Suppose you issue this command:

 

Stop-CsWindowsService –Name RTCCAA

 

What's going to happen then? Well, the RTCCAA service is going to stop, immediately, and anyone currently using that service is going to be cut off.

 

Not a very pleasant experience, to say the least.

 

But now consider this command:

 

Stop-CsWindowsService –Name RTCCAA -Graceful

 

When you include the Graceful parameter, the RTCCAA service will not accept any new connections. However, it also will not stop until all its existing service requests are filled. New callers won't be able to access the service, but no one will be abruptly cut off.

 

A much more pleasant experience, to say the least.

 

We think you can see why the CsWindowsService cmdlets make such an ideal gift. And for any wedding, not just a royal wedding.

 

That's all we have time for today; we need to go down and check the mail. Not only are we waiting for our invitation to the royal wedding, but we're still waiting for our appointment to the Royal Household. After all, the Queen already has a Master of the Household, a Master of the Horse, a Master of the Queen's Music, the Queen's Bargemaster, and both a Warden of the Swans and a Marker or the Swans. We're assuming that our appointment as Masters of the Queen's Lync Server PowerShell can't be far behind.