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:voicemailuser@contoso.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:
Set-CsRgsWorkflow $workflow
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.
Further Reading
- 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.
Revision History
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.
– G.
Playing with csrgsprompt and you should monitor the RGS Temp folder on the Lync file share (\\lyncfileshare\Lync\1-ApplicationServer-1\AppServerFiles\Rgs\Temp) as the old files may get stuck there.
Hi Greig,
How do you update/change the holiday of a work flow. Example a new 2017 holiday set is created for this year, how would i assign this to all the work flow and replace the current one that has been assigned.
2 options, both from Andrew over the pond in NZ:
The long-term management solution for Response Groups is his amazingly comprehensive GUI “Call Flow Manager”:
https://theucguys.com/call-flow-manager/
Alternatively, Andrew’s also written a self-contained script that does the job of managing Public Holidays nicely:
https://gallery.technet.microsoft.com/Create-Lync-Response-Group-90786b15
– don’t forget to give it a 5-start rating while you’re there!!
– G.