I was presented with the challenge today of updating the recorded after-hours message of many Lync Response Group workflows through PowerShell.
The process wasn’t well documented anywhere, so I thought I’d publish our end solution.
- First off, you’ll want to capture the Identity of your workflow. This commandlet should help you fish it out of the mire:
get-CsRgsWorkflow | ft Identity,Name -auto
- It would be wise now to capture the current config of the Workflow to a file:
get-CsRgsWorkflow service:ApplicationServer:<ApplicationIdentity> > <filename> get-CsRgsWorkflow service:ApplicationServer:lyncfe.contoso.local/c416d398-1234-1234-1234 > C:\MyWorkflow.txt
- We have a suitably-formatted audio file ready to import, so let’s load it into a variable as a new CsRgsAudioFile:
$audioFile = Import-CsRgsAudioFile -Identity "service:ApplicationServer:lyncfe.contoso.local" -FileName "NewNightMessage.wav" -Content (Get-Content C:\NewNightMessage.wav -Encoding byte -ReadCount 0)
- Now we create a new CsRgsPrompt that links to the file. (Here is where we would add the message text if we were instead going to use TTS)
$prompt = New-CsRgsPrompt -AudioFilePrompt $audioFile -TextToSpeechPrompt ""
(As I document in this post, I’ve encountered several instances where an RGS will hang up on you if you use an audio file prompt and don’t also specify an empty string as a TTS prompt).
- Create a new CsRgsCallAction that is the "Action" the workflow will take when we’re closed. In this case our two-step Action will be to play a prompt and then transfer the call to voicemail:
$action = New-CsRgsCallAction –prompt $prompt -Action TransferToVoicemailUri -Uri "sip:email@example.com"
- Read the workflow into a variable:
$workflow = get-csRgsWorkflow “service:ApplicationServer:lyncfe.contoso.local/c416d398-1234-1234-1234”
- This step sets the action as the one that will take place when we’re closed, i.e. our NonBusinessHours:
$workflow.NonBusinessHoursAction = $action
- And finally we write the modified workflow back in over the existing one:
It seems quite intricate, but hopefully it makes sense laid out like this. The trick is remembering that we can’t retain any aspects of the previous "NonBusinessHoursAction", as they’re completely over-written when we add the new one in Step 7. Thus, whilst we only wanted to update the recorded message, we also had to ‘replace’ (or re-state) the call forward component too.
- Audio file formats for Lync and Exchange
- Response Group application cmdlets in Lync Server 2013
- Create or modify a hunt group workflow in Lync Server 2013
- Lync Server Admin Guide: Managing Response Groups
- Creating Your First Response Group Using Lync Server Management Shell
And of course if you’re really lucky Andrew’s new “Call Flow Manager” RGS GUI app will make the whole process redundant anyway.
28th July 2015: This is the initial post.
2nd September 2017: Added reference and link to my post re RGS hanging up if the RgsPrompt doesn’t contain a TTS greeting.