Haiku #66
Published May 20 2019 03:11 PM 77 Views
Occasional Visitor
First published on TECHNET on Mar 14, 2011

What's done is done. Now

It's time to erase the past.


Yesterday was "Selection Sunday," the day that they choose the 68 teams that will compete in the NCAA basketball tournament. For the author of today's haiku, Selection Sunday is by far the most exciting and most-anticipated day of the year.

And yes, that does include March 18 th , the birthdate of former US President Grover Cleveland .

Note . Cleveland's actual name was Stephen Grover Cleveland and yet, for some reason, he chose to go by the name "Grover." Which, now that you mention it, should have disqualified him from ever becoming President, shouldn't it?

But, then again, even Grover was probably a step up from his nickname, Uncle Jumbo .

At any rate, in honor of Selection Sunday, the authors of the Lync Server PowerShell blog thought it might be fun to choose our 68 favorite Lync Server cmdlets, rank them 1 through 68, put them in a bracket, and then have those cmdlets square off against one another in our own version of "March Madness," using a custom algorithm (based on each cmdlet's ease of use and on its importance to Lync Server) to eventually determine the absolute, no-question-about-it best Lync Server PowerShell cmdlet. But after we thought about that for a second, and realized how much work that was going to take, we decided that an even better way to honor Selection Sunday was to simply throw together a haiku about the Clear-CsDeviceUpdateLog cmdlet instead.

Note . Is that taking the easy way out? Well, maybe. On the other hand, between Thursday morning and Sunday evening, we have 52 college basketball games to watch, including 16 that will take place on Grover Cleveland's birthday! Obviously we have to save our energy as much as possible.

In the meantime, what about the Clear-CsDeviceUpdateLog cmdlet? Well, the truth is, Clear-CsDeviceUpdateLog might have won our hypothetical March Madness competition anyway; after all, it is easy to use, and it's definitely a handy little cmdlet to know about. As you might already know, the device update service is a Lync Server component that makes it easy to download firmware updates from Microsoft and then distribute those updates to devices running Microsoft Lync 2010 Phone Edition. In the course of handling all these firmware updates, the device update service collects a large number of log files; this includes log files generated by the service itself, as well as log files that can be uploaded from client devices. Those log files provide you with a wealth of information in case you need to do some troubleshooting.

On the other hand, and depending on how many client devices you have, you also run the risk of overwhelming your server with too many log files, files that you don't really need anymore. Fortunately, though, the Clear-CsDeviceUpdateLog cmdlet makes it easy for you to cull through these log files. For example, suppose last week everything went absolutely perfect with the device update service and with all your client devices. With that in mind, there's probably no reason to keep all the log files from a week ago; after all, there weren't any problems that might require you to look through those logs. With that in mind, you can delete all the log files 7 days old (or older) just by issuing one simple command:

Clear-CsDeviceUpdateLog -Identity "service:WebServer:atl-cs-001.litwareinc.com" -DaysBack 7

Yep, that's it: specify the location of the device update service (service:WebServer:atl-cs-001.litwareinc.com) and then specify the time period by using the DaysBack parameter. When you run the preceding command, all the log files 7 days old (or older) will be deleted from the server. And what about logs files that are, say, 4 days old? Well, seeing as how log files 4 days old aren't older than 7 days old then those files won't be deleted.

You can see why we found Clear-CsDeviceUpdateLog to be so easy to use.

Of course, having said that, we should also mention that there is one tricky little aspect to working with Clear-CsDeviceUpdateLog. The command we just showed you clears the device update log files for a single Web server: the Web server located on atl-cs-001.litwareinc.com. But what if you'd like to clear the log files for all your Web servers? How in the world do you do that ?

Well, like we said, it's a little bit tricky, and for two reasons: 1) you have to know how to retrieve a collection of all your Web servers (there doesn't happen to be a Get-CsWebServer cmdlet); and, 2) you then have to figure out what to do with that collection, seeing as how the Clear-CsDeviceUpdateLog doesn't directly accept pipelined input. But, as Grover Cleveland used to say (or at least as we assume he used to say): where there's a will there's a way. And here's a way to clear the log files for all your Web servers, and with a single command:

Get-CsService –WebServer | ForEach-Object {Clear-CsDeviceUpdateLog –Identity $_.Identity –DaysBack 7}

What we've done here is use the Get-CsService cmdlet and the WebServer parameter to return a collection of all our Web servers. We've then piped that collection to the ForEach-Object cmdlet; that's because we can then use ForEach-Object to loop through each item in the collection and, for each of those items, use the Clear-CsDeviceUpdateLog cmdlet to clear the device log files. Not the most obvious way to do things, but it should work.

In the meantime, enjoy March Madness. And remember: the University of Washington Huskies (Go Dawgs!) play Friday evening at 6:45 PM Pacific Daylight time.

Oh, and happy Grover Cleveland's Birthday to everyone, too!

Version history
Last update:
‎May 20 2019 03:11 PM
Updated by: