Redigera

Dela via


Import-CSAnnouncementFile

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

Syntax

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

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.

Examples

-------------------------- EXAMPLE 1 --------------------------

$a = [System.IO.File]::ReadAllBytes('.\GreetingFile.wav')

Import-CsAnnouncementFile -Parent ApplicationServer:redmond.litwareinc.com -FileName "WelcomeMessage.wav" -Content $a

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 retrieve the audio file as an array of individual 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.

-------------------------- EXAMPLE 2 --------------------------

Import-CsAnnouncementFile -Parent ApplicationServer:redmond.litwareinc.com -FileName "WelcomeMessage.wav" -Content ([System.IO.File]::ReadAllBytes('.\GreetingFile.wav'))

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

-------------------------- EXAMPLE 3 --------------------------

[System.IO.File]::ReadAllBytes('.\GreetingFile.wav') | Import-CsAnnouncementFile -Parent ApplicationServer:redmond.litwareinc.com -FileName "WelcomeMessage.wav"

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 command to read the file, then pipe the results to Import-CsAnnouncementFile. This is the most reliable way of importing an announcement file from a remote session.

Parameters

-Confirm

Prompts you for confirmation before executing the command.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

-Content

The contents of the audio file as a byte array.

A valid value for this parameter requires you to read the file to a byte-encoded object using the following syntax: ([System.IO.File]::ReadAllBytes('<Path>\<FileName>')). You can use this command as the parameter value, or you can write the output to a variable ($data = [System.IO.File]::ReadAllBytes('<Path>\<FileName>')) and use the variable as the parameter value ($data).

Type:Byte[]
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False
Applies to:Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

-FileName

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.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

-Force

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

-Parent

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

Type:String
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

Inputs

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

Outputs

This cmdlet does not return a value.