For those out there using Group Policy on your Lync or Skype for Business servers to configure QoS, I wanted to make sure you’re aware of a method to set your QoS markings via quick and easy PowerShell commands using Net-NewQoSPolicy. This PowerShell command is available in Windows Server 2012 R2 and up, which you’ll see most new deployments using, and Windows 8.1 and up, which isn’t always rolled out completely in an organization.
Elan Shudnow created his authoritative QoS blogs a while back, which I live by and we will be referencing today. The 2013 versions are here:
Because I highly recommend the reading of these articles, and I reference them regularly myself, we will be using the same ports the Elan uses in his articles within our PowerShell commands. Specifically, that means using the following non-default ranges:
- Modifying application sharing from the default range of 49152-65535, which overlaps with audio and video ports, to the more unique range 40803-49151.
- Modifying client ports from the default of any high port 1024-65535 to the following:
- Client Audio Ports: 20000-20039
- Client Video Ports: 20040-20079
- Client App Sharing Ports: 20080-20119
- Client File Transfer Ports: 20120-20159
- Client Media Ports: 20160-20199
To set these values, the following two commands should be run from the Lync or Skype for Business Management Shell:
Set-CsConferenceServer -Identity <Front End Pool FQDN> -AppSharingPortStart 40803 -AppSharingPortCount 8348
Set-CsConferencingConfiguration -ClientAudioPort 20000 -ClientAudioPortRange 40 -ClientVideoPort 20040 -ClientVideoPortRange 40 -ClientAppSharingPort 20080 -ClientAppSharingPortRange 40 -ClientFileTransferPort 20120 -ClientFileTransferPortRange 40 -ClientMediaPort 20160 -ClientMediaPortRange 40
Also, we’re going to set our DSCP markings using the following tags:
- Audio = DSCP 46 (EF)
- Video = DSCP 34 (AF41)
- All Else = No tag, best effort
Now, on to the fun part, setting our DSCP values via PowerShell. On each Front End server, run the following commands:
New-NetQosPolicy -Name “Skype Conferencing Audio” -IPProtocol Both -IPSrcPortStart 49152 -IPSrcPortEnd 57500 -DSCPValue 46
New-NetQosPolicy -Name “Skype Conferencing Video” -IPProtocol Both -IPSrcPortStart 57501 -IPSrcPortEnd 65535 -DSCPValue 34
On a Mediation Server, we’re only concerned with audio traffic and we can pin it down to the Mediation service specifically.
New-NetQosPolicy -Name “Skype Mediation” -AppPathName “MediationServerSvc.exe” -IPProtocol Both -IPSrcPortStart 49152 -IPSrcPortEnd 57500 -DSCPValue 46
Quick and easy, no MMC or policy! Drop it in with your prerequisites. If you have many many servers, an AD level group policy may still save you time however, so use your own judgement.
If you have a mix of operating systems in the environment, I would still suggest using group policy for these as only Windows 8.1 and up support this command. However, if you do happen to have a PowerShell workstation provisioning script, here are the commands you would need and a screenshot of them being executed on Windows 10:
New-NetQosPolicy -Name “Skype Client Audio” -AppPathName “lync.exe” -IPProtocol Both -IPSrcPortStart 20000 -IPSrcPortEnd 20039 -DSCPValue 46
New-NetQosPolicy -Name “Skype Client Video” -AppPathName “lync.exe” -IPProtocol Both -IPSrcPortStart 20040 -IPSrcPortEnd 20079 -DSCPValue 34
One final note before I leave you, if you receive an “New-NetQosPolicy : Access to a CIM resource was not available to the client.” error, make sure you’re running your PowerShell as administrator, we are making a machine-wide change after all.