onsdag den 31. maj 2017

Manage Response Groups in Powershell

When managing Response Groups in SKYPE for Business, the tool needed is the Classic "Manage or edit Workflows" Website - very often customers ask if they can control these options by powershell, or even automate some actions.




This is indeed possible, the powershell way may seem a bit wrinkled - but it works. :)

I will describe the two most commonly used task - that is changing the PSTN forward location for out of Business Hours, and also changing the prompt (audiofile) and Voicemail

First the Process for changing the Audio File and setting forward to Voicemail - if for example you want change the wording from "You are now being forwarded to VoicemailA" - to "You are being forwarded to VoicemailB"

First of you should identify your Response Groups workflows - we need the Identity string for later.

Run this in Powershell:

get-CsRgsWorkflow | ft Identity,Name -auto


If you want to you can now save the current config to a txt file

get-CsRgsWorkflow service:ApplicationServer:FE1.spinne.local/d546f544-1443-1443-1234 > C:\Workflow.txt
In the meantime prepare the new audiofile - keeping requirements in mind:
https://technet.microsoft.com/en-us/library/gg398649(v=ocs.14).aspx
And then load it into a variable as a new CsRgsAudioFile:
$audioFile = Import-CsRgsAudioFile -Identity "service:ApplicationServer:FE1.spinne.local" 
 -FileName "Audioprompt.wav" -Content (Get-Content C:\Audioprompt.wav -Encoding byte -ReadCount 0)
Now create a new CsRgsPrompt that links to the file.
 (Type the text here if you were instead going to use Text To Speech) 
$prompt = New-CsRgsPrompt -AudioFilePrompt $audioFile
Now Create a new CsRgsCallAction that is the Action the workflow will take when Outside Business Hours.
 In this case two Actions will occur, play a prompt and then transfer the call to voicemail
$action = New-CsRgsCallAction –prompt $prompt -Action TransferToVoicemailUri -Uri "sip:voicemail@spinne.dk"
Now Read the whole workflow into its own Variable
$workflow = get-csRgsWorkflow “service:ApplicationServer:FE1.spinne.local/d546f544-1443-1443-1234”
Now we can customize the workflow by adding the action defines earlier:
$workflow.NonBusinessHoursAction = $action
And finally write the whole thing back to existing workflow - and thereby owerwrtiting existing config.
Set-CsRgsWorkflow $workflow
So a script doing the whole process in one step would look like this:

$audioFile = Import-CsRgsAudioFile -Identity "service:ApplicationServer:FE1.spinne.local" 
 -FileName "Audioprompt.wav" -Content (Get-Content C:\Audioprompt.wav -Encoding byte -ReadCount 0)
$prompt = New-CsRgsPrompt -AudioFilePrompt $audioFile
$action = New-CsRgsCallAction –prompt $prompt -Action TransferToVoicemailUri -Uri "sip:voicemail@spinne.dk"
$workflow = get-csRgsWorkflow “service:ApplicationServer:FE1.spinne.local/d546f544-1443-1443-1234”
$workflow.NonBusinessHoursAction = $action
Set-CsRgsWorkflow $workflow

Now you could save different PS1 files named by name of Workflow, or even take it at step further, 
putting the whole thing into Orchestrator and making e.g. Voicemail destination as an variable.
Also worth noting the power of the New-csRGScallaction cmdlet - read more here:
https://technet.microsoft.com/en-us/library/gg398136.aspx

The next example is more simple, but also more commonly used - it simply changes the PSTN number that the
Workflow forwards to when outside business hours.

$action = New-CsRgsCallAction -Action TransferToPSTN -Uri "sip:+4511111111@spinne.dk"
$workflow = get-csRgsWorkflow “service:ApplicationServer:FE1.spinne.local/d546f544-1443-1443-1234”
$workflow.NonBusinessHoursAction = $action
Set-CsRgsWorkflow $workflow
Thats it :)
Lastly i wanna point your attention to a brilliant script made available on Technet - making it possible to automatically 
cycle between PSTN forwards, for example if you have a IT hotline where We rotate the on call responsibility weekly between the techies on duty. 
That script can be found here:
https://gallery.technet.microsoft.com/office/Lync-Workflow-off-hours-da661656

As Always Happy SKYPE'ing

torsdag den 18. maj 2017

May 2017 patches for SKYPE for Business server

A Cumulative update has been released today for SKYPE for Business servers.
And finally full support for "Server 2016" is here.


This CU contains ALOT of fixes for both minor issues and major annoyances like The VoicemailonBusy limitation when running exchange online. And also another MAJOR improvement is the simplified Meeting Join experience. Se lets get to it :)

The patch version number is:6.0.9319.281
To find out which version you are currently running please run this i Powershell:
Get-WmiObject –query ‘select * from win32_product’ | where {$_.name –like “*SKYPE for business*”} | ft Name, Version –AutoSize

The patch is found here:
http://www.microsoft.com/en-us/download/details.aspx?id=47690

This CU includes updates for the following roles:
  • Skype for Business Server 2015 - Standard Edition server
  • Skype for Business Server 2015 - Enterprise Edition - front-end server and back-end server
  • Skype for Business Server 2015 - Edge server
  • Skype for Business Server 2015 - stand-alone Mediation server
  • Skype for Business Server 2015 - Director server
  • Skype for Business Server 2015 - Persistent Chat front-end server
  • Skype for Business Server 2015 - Administration Tools
  • Skype for Business Server 2015 - Video Interop server
The long list of fixes are:
  • 4020997 Skype for Business Server 2015 Front-End service may crash in Windows Server 2016
  • 4020994 Event ID 36023 is consistently logged on Multiple Front-End servers in a Skype for Business Server 2015 environment that enables CAC
  • 4020993 DTMF tone isn’t played when some DTMF packets are dropped in the network in Skype for Business Server 2015
  • 4020991 Enables “move-csmeetingroom” cmdlet to move meeting room from on-premises to Online in Skype for Business Server 2015
  • 4020987 The update to OcsMcu.msp can't be applied when conferencing is disabled in Skype for Business Server 2015
  • 4020984 The ms-client-diagnostics header for application sharing scenario is not correctly formatted in Skype for Business Server 2015
  • 4020983 “sorry, I didn't get that...” GVA announcement is triggered by external audio sources in Skype for Business Server 2015
  • 4019726 Call remains ringing on a PSTN phone when you click End Meeting in a Skype meeting in Skype for Business Server 2015
  • 4019725 Event ID 44005 and 44008 are logged when you try to leave a voicemail in Skype for Business Server 2015
  • 4019724 You cannot join Skype meeting after you perform a pool failover in Skype for Business Server 2015
  • 4019723 Agents in a Response Group can’t receive call after you invoke pool failover in Skype for Business Server 2015
  • 4019722 Event ID 30210 occurs when you try to leave voicemail in Skype for Business Server 2015
  • 4015911 Pool failover fails when you have many conference directories in Skype for Business Server 2015
  • 4015910 Event ID 53106 "Unable to Save Message" occurs in Skype for Business Server 2015 Persistent Chat Server
  • 4015907 Update that enables simplified meeting join experience in Skype for Business Server 2015
  • 4015904 Enables UCWA to populate "OTHER CONTACTS" and "FAVORITES" groups at first sign in to Skype for Business mobile app
  • 4015902 Failed to start MatchMaking service and its dependencies if FIPS for RGS is enabled in Skype for Business Server 2015
  • 4015901 Calls to RGS may fail after an in-place upgrade from Lync server 2013 to Skype for Business Server 2015
  • 4015900 Enables “VoicemailOnBusy” ActionType to be set for Exchange Online users in Skype for Business Server 2015 Busy Options
  • 4015899 "Busy Options" feature doesn’t check the second incoming call in Skype for Business Server 2015
  • 4015898 RGS agents may stop receiving calls after you run the “Enable-CsTopology” cmdlet in Skype for Business Server 2015
  • 4015893 Enables delegate management feature for Unified Communications Web API in Skype for Business Server 

PLEASE remember the database updates in this patch

Installation methods (Taken from official KB guidance)

Install the cumulative updates

The Cumulative Server Update Installer applies all updates for the appropriate server role in one operation.

Note If User Account Control (UAC) is turned on, you must start the Cumulative Server Update Installer by using elevated permissions to make sure that all updates are installed correctly.
  Note Updates for Skype for Business Server 2015 will no longer be auto-installed by Microsoft Update. You must manually download SkypeServerUpdateInstaller.exe from Microsoft Update, and then use the following installation steps.

To apply the update to the Front End servers in a pool

  1. Type the following cmdlet:
    Get-CsPoolFabricState -PoolFqdn <PoolFQDN> 
    If this cmdlet shows any missing replicas, then run the following cmdlet to recover the pool before you apply any patches:
    Reset-CsPoolRegistrarState -ResetType QuorumLossRecovery 
  2. On the first server you want to patch, run the following cmdlet:
    Invoke-CsComputerFailOver -ComputerName <Front End Server to be patched> 
    This cmdlet moves all services to other Front End Servers in the pool, and takes this server offline.
  3. Run the Cumulative Server Update Installer and click Install Updates to upgrade the server role.

    You can also run the following parameters together with the SkypeServerUpdateInstaller.exe command:
     
    • The /silentmode switch applies all applicable updates in the background.
    • The /silentmode /forcereboot switch applies all applicable updates in the background, and then automatically restarts the server at the end of the installation process if this is necessary.
    • The /extractall switch extracts the updates from the installer, and saves the updates in a subfolder that is named "Extracted" in the folder in which you ran the command.
  4. On the upgraded server, run the following cmdlet:
    Invoke-CsComputerFailBack -ComputerName <Front End Server to be patched> 
    The server is returned to service.
  5. Repeat Steps 2-4 for each server that needs to be upgraded.

To apply the update to a back end server or Standard Edition server

  1. Log on to the server you are upgrading as a member of the CsAdministrator role.
  2. Start the Skype for Business Server Management Shell: Click Start, click All Programs, click Skype for Business 2015, and then click Skype for Business Server Management Shell.
  3. Stop Skype for Business Server services. At the command line, type:
    Stop-CsWindowsService 
  4. Stop the World Wide Web service. At the command line, type:
    net stop w3svc 
  5. Close all Skype for Business Server Management Shell windows.
  6. Run the Cumulative Server Update Installer and click Install Updates to upgrade the server role.

    You can also run the following parameters together with the SkypeServerUpdateInstaller.exe command:
     
    • The /silentmode switch applies all applicable updates in the background.
    • The /silentmode /forcereboot switch applies all applicable updates in the background, and then automatically restarts the server at the end of the installation process if this is necessary.
    • The /extractall switch extracts the updates from the installer, and saves the updates in a subfolder that is named "Extracted" in the folder in which you ran the command.
  7. Start the Skype for Business Server Management Shell: Click Start, click All Programs, click Skype for Business 2015, and then click Skype for Business Server Management Shell.
  8. Stop Skype for Business Server services again to catch Global Assembly Cache (GAC) –d assemblies. At the command line, type:
    Stop-CsWindowsService 
  9. Restart the World Wide Web service. At the command line, type:
    net start w3svc 
  10. Apply the changes made to the SQL Server databases by doing one of the following:

    Note When you run the Install-CsDatabase cmdlet, you will receive an error that you can safely ignore. The error message in the request is expected if you are updating the database on a computer that isn't hosting the Central Management Store.
     
    • If this is an Enterprise Edition Back End Server and there are no collocated databases on this server, such as Archiving or Monitoring databases, then type the following at a command line:
      Install-CsDatabase -Update -ConfiguredDatabases -SqlServerFqdn <SQL Server FQDN> 
    • If this is an Enterprise Edition Back End Server and there are collocated databases on this server, then type the following at a command line:
      Install-CsDatabase -Update -ConfiguredDatabases -SqlServerFqdn <SQL Server FQDN>  -ExcludeCollocatedStores 
    • If this is an Standard Edition server, type the following at a command line:
      Install-CsDatabase -Update -LocalDatabases 

AS always - Happy SKYPE'ing