Topic Last Modified: 2015-03-09

Imports a new audio file for use with the Response Group application. This cmdlet was introduced in Lync Server 2010.

Import-CsRgsAudioFile -Content <Byte[]> -FileName <String> -Identity <RgsIdentity> [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

The commands shown in Example 1 import an audio file (C:\Media\WhileYouWait.wav) and then assign that file to the CustomMusicOnHold property of a workflow. To perform this task, the first command uses Import-CsRgsAudioFile to import the audio file to the Response Group application found on In addition to the Identity parameter (which specifies the service location) the FileName parameter is used to specify the file name of the file being imported.

At the same time, the Content parameter is used to import the audio file. File importing is carried out by calling the Get-Content cmdlet followed by the path to the file being imported. Get-Content also requires you to set the encoding type to byte and the ReadCount to 0. (Setting the ReadCount to 0 ensures that the entire file is read in in a single operation.) The imported file is then stored in a variable named $x.

In the second command, Get-CsRgsWorkflow is used to create an object reference ($y) to the workflow Help Desk Workflow. After this object reference has been created, command 3 sets the value of the CustomMusicOnHoldFile property to $x, the variable containing the imported audio file. Finally, the last command in the example uses Set-CsRgsWorkflow to write these changes to the actual workflow Help Desk Workflow. If you do not call Set-CsRgsWorkflow, your modifications will exist only in memory, and will disappear as soon as you close Windows PowerShell or delete the variables $x or $y.

$x = Import-CsRgsAudioFile -Identity "" -FileName "WhileYouWait.wav" -Content (Get-Content C:\Media\WhileYouWait.wav -Encoding byte -ReadCount 0)

$y = Get-CsRgsWorkflow -Identity "" -Name "Help Desk Workflow"
$y.CustomMusicOnHoldFile = $x

Set-CsRgsWorkflow $y

The Response Group application can use audio files (.WAV or .WMA formats only) in at least two different ways. For one, the service can play music (or an announcement of some type) any time callers are placed on hold. Alternatively, the Response Group application occasionally "talks" to callers; for example, with interactive voice response (IVR) the service might ask callers a question such as "Are you calling about an existing order?" You can have the service read these questions using text-to-speech technology or you can play an audio recording of an actual person asking the question.

Regardless of how you choose to use audio files, the files themselves must be imported into the Response Group application by using the Import-CsRgsAudioFile cmdlet. Note that you must run Import-CsRgsAudioFile each time you want to use an audio file, even if that file is already being used elsewhere in the Response Group application. For example, suppose Workflow A uses a given audio file as its custom music on hold file and you now want to use that same audio file as the custom music on hold for Workflow B. Even though the audio file is already used by the Response Group application you will still need to import the file in order to use it with Workflow B.


Parameter Required Type Description




Actual content of the audio file being imported. The Content property is populated by calling the Get-Content cmdlet. When calling Get-Content, set the Encoding parameter to byte and the ReadCount parameter to 0 (for details, see the Examples section in this topic).




File name for the audio file being imported. For example, the file name for the file C:\Media\Welcome.wav is this: Welcome.wav.




Identity of the service where the audio file is to be imported. (This must be the same service that hosts the Response Group application.) For example: -Identity "".




Prompts you for confirmation before executing the command.




Suppresses the display of any non-fatal error message that might occur when running the command.




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

None. Import-CsRgsAudioFile does not accept pipelined input.

Creates new instances of the Microsoft.Rtc.Rgs.Management.WritableSettings.AudioFile object.