Break glass in case of
A haiku emergency.
OK, so, originally we planned to have a really exciting and interesting haiku for you today. (Hey, who said, “Well, that would be a nice change”?) Like we said, we planned to have a really exciting and interesting haiku for you today but then … stuff … began to happen, most of it happening between the hours of 3:00 AM and 6:00 AM, and most of it involving an issue that turned out not to be an issue after all, and a long car trip that turned out not to be a long car trip after all.
At any rate, all’s well that ends well and in this case, at least, everything ended perfectly well. Except for one thing: somewhere along the way, we must have misplaced our really exciting and interesting haiku, because the only haiku that we could find was this one.
Fortunately, though, there’s a bright side here: after all, there’s no such thing as a truly bad Lync Server PowerShell haiku. (OK, good point. But we didn’t write that one.) And today’s haiku is no exception; after all, today’s topic is the Import-CsAnnouncementFile cmdlet. Which means that, now that we think about it, we just might have a really exciting and interesting haiku for you after all.
So what’s an announcement file? Well, with Lync Server you will likely have valid phone numbers that are currently not assigned to a user. If you want, you can configure an audio file to be played any time someone dials one of those unassigned numbers. For example, you might play a recording that says something like “We’re sorry, but the number you have dialed is not currently in service. Your call will now be transferred to our receptionist.” Alternatively, you might play In-A-Gadda-Da-Vida by Iron Butterfly. It’s entirely up to you.
The important thing is that you can play an audio file (a .WAV or .WMA file) of some kind whenever someone dials an unassigned number (and right before you would then typically transfer that call to another user, to voicemail, etc). And how do you import one of these announcement files to Lync Server 2010? Why, like this, of course:
Get-Content “C:AudioFilesNoOneIsHere.wav” -ReadCount 0 -Encoding Byte | Import-CsAnnouncementFile -Parent ApplicationServer:atl-cs-001.litwareinc.com -FileName “NoOneIsHere.wav”
What exactly have we done here? Well, we’ve first used the Get-Content cmdlet to retrieve the contents of the file C:AudioFilesNoOneIsHere.wav. Note that we’ve also included the ReadCount and the Encoding parameters. Setting the ReadCount to 0 ensures that the file is read in all at the same time (as opposed to being read in piece-by-piece), while setting the Encoding property to Byte tells Get-Content to read the file as a series of bytes rather than, say, a series of plain-text characters.
After we’ve retrieved the file using Get-Content, we then save that file to Lync Server by using the Import-CsAnnouncementFile cmdlet. To do that we need to specify the service location of the Application Server where the file will be stored (in this case, that’s ApplicationServer:atl-cs-001.litwareinc.com) and we need to give the file a file name. For this file, that file name is NoOneIsHere.wav.
As soon as you’ve imported the file, it can then be used by the Lync Server announcement service. We won’t discuss the details in today’s haiku (after all, we already discussed the details in haiku #31), but here’s a sample command that turns our imported file into a real, live announcement:
New-CsAnnouncement -Identity ApplicationServer:atl-cs-001.litwareinc.com -Name “No One is Here” -AudioFilePrompt “NoOneIsHere.wav”
That’s all you have to do.
Coincidentally enough, that’s all that we have to do, at least for now. But don’t worry: we’re going to spend the rest of the day writing Lync Server PowerShell haikus and storing them away in case of emergency. Next time, we’re going to be better prepared.
See you tomorrow.