Topic Last Modified: 2012-08-11

Imports an announcement file to the Announcement service audio library. This cmdlet was introduced in Lync Server 2010.

Syntax

Import-CSAnnouncementFile -Content <Byte[]> -FileName <String> -Parent <String> [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

Examples

EXAMPLE 1

These commands import an audio file into the Announcement service File Store. Because audio files must be imported as byte arrays, we first need to call the Get-Content cmdlet to retrieve the audio file as an array of individual bytes. Get-Content is a Windows PowerShell built-in cmdlet to which we pass the name (including path) of the file we want to use for our announcement. Next we pass a value of 0 to the ReadCount parameter, meaning we want to read the whole file at once. We then pass a value of Byte to the Encoding parameter, which tells Get-Content that we want the contents of the file as an array of bytes. We assign that array to the variable $a.

In the second line we call the Import-CsAnnouncementFile cmdlet to actually import the file. We pass the service Identity ApplicationServer:redmond.litwareinc.com to the Parent parameter, then we pass a name to the FileName parameter (WelcomeMessage.wav). This can be any valid Windows operating system file name, but it should end with a .wav or .wma extension. Finally, we pass the variable $a as the value to the Content parameter to read in our byte array.

Copy Code
$a = Get-Content ".\GreetingFile.wav" -ReadCount 0 -Encoding Byte
Import-CsAnnouncementFile -Parent ApplicationServer:redmond.litwareinc.com -FileName "WelcomeMessage.wav" -Content $a

EXAMPLE 2

Example 2 is identical to Example 1 except that we included the Get-Content command inside parentheses as a value to the Content parameter rather than calling that command on its own and assigning it to a variable.

Copy Code
Import-CsAnnouncementFile -Parent ApplicationServer:redmond.litwareinc.com -FileName "WelcomeMessage.wav" -Content (Get-Content ".\GreetingFile.wav" -ReadCount 0 -Encoding Byte)

EXAMPLE 3

Example 3 is yet another variation of Example 1. The difference in this example is that rather than use the Content parameter, we first call the Get-Content cmdlet, then pipe the results to Import-CsAnnouncementFile. This is the most reliable way of importing an announcement file from a remote session.

Copy Code
Get-Content ".\GreetingFile.wav" -ReadCount 0 -Encoding Byte | Import-CsAnnouncementFile -Parent ApplicationServer:redmond.litwareinc.com -FileName "WelcomeMessage.wav"

Detailed Description

This cmdlet imports an audio file as a byte array to the Announcement service audio library. This makes the file available for playback as an announcement for unassigned numbers.

Running this cmdlet imports the audio file to the library. After the file has been imported, the file can be used in an announcement by calling the New-CsAnnouncement cmdlet or the Set-CsAnnouncement cmdlet and passing the file name and associated service as parameters. At that point the New-CsUnassignedNumber or Set-CsUnassignedNumber cmdlet can be called to assign the announcement to a specific range of numbers.

Imported files must be WAV or WMA files.

Who can run this cmdlet: By default, members of the following groups are authorized to run the Import-CsAnnouncementFile cmdlet locally: RTCUniversalServerAdmins. However, the cmdlet can also be run by anyone with write access to the destination computer File Store. To return a list of all the role-based access control (RBAC) roles this cmdlet has been assigned to (including any custom RBAC roles you have created yourself), run the following command from the Windows PowerShell prompt:

Get-CsAdminRole | Where-Object {$_.Cmdlets –match "Import-CsAnnouncementFile"}

Parameters

Parameter Required Type Description

Content

Required

System.Byte[]

The contents of the audio file as a byte array.

FileName

Required

System.String

The name that you want the file to have in the File Store. You will use this name in the AudioFilePrompt parameter in the call to the New-CsAnnouncement or Set-CsAnnouncement cmdlet to assign the file to an announcement.

Parent

Required

System.String

The service ID of the Application Server on which the associated Announcement service is running.

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command.

Force

Optional

System.Management.Automation.SwitchParameter

Suppresses any confirmation prompts that would otherwise be displayed before making changes.

WhatIf

Optional

System.Management.Automation.SwitchParameter

Describes what would happen if you executed the command without actually executing the command.

Input Types

Byte[]. Accepts a byte array from an audio file. Byte array must be piped as a single record. See Example 3.

Return Types

This cmdlet does not return a value.