/TurboRemoteFX

Powershell script to optimize RDP performance.

Primary LanguagePowerShell

TurboRemoteFX

Powershell script which changes Group Policy and Registry entries to increase RDP (Remote Desktop) performance. (Enabling RemoteFX and Hardware, ie. GPU, H.264/AVC Encoding)

Based on the following sources:

Usage

Requirements:

  • You need to install the PolicyFileEditor Powershell Module. To do this run:

    PS> Install-Module -Name PolicyFileEditor -Scope CurrentUser

To make the Group Policy/Registry changes:

  1. Download and extract the files.

  2. Open Administrator PowerShell to that directory.

  3. Then run the following:

    PS> Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process ; .\TurboRemoteFXHostGPO.ps1
  4. To assert the Group Policy changes run:

    PS> gpupdate /force

To undo the changes:

  • Follow the steps above except use the TurboRemoteFXHostGPO-inverse.ps1 script.

    PS> Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process ; .\TurboRemoteFXHostGPO-inverse.ps1

Also recommended:

  • If using NVIDIA, you should also grab their extra driver to support OpenGL over RDP
  • Client side changes
    • When opening an RDP connection make the settings:
      • Network Type: LAN
      • Persistent Bitmap Caching: No

About

The scripts simply automate making changes in Group Policy and the Registry.

Equivalent gpedit.msc changes

All changes take place inside the path:

Local Computer Policy
\ Computer Configuration
  \ Administrative Templates
    \ Windows Components
      \ Remote Desktop Services
        \ Remote Desktop Session Host

From there, the following locations take changes:

In \Connections

Select RDP Transfer Protocols = Enabled
Set Transport Type to: "Use both UDP and TCP"

In \Remote Session Environment

Use hardware graphics adapters for all Remote Desktop Services Sessions = Enabled
Prioritize H.264/AVC 444 graphics mode for Remote Desktop Connections = Enabled
Configure H.264/AVC Hardware encoding for Remote Desktop Connections = Enabled
    Set "Prefer AVC hardware encoding" to "Always attempt"
Configure compression for Remote FX data = Enabled
    Set RDP compression algorithm: "Do not use an RDP compression algorithm"
Configure image quality for RemoteFX Adaptive Graphics = Enabled
    Set Image Quality to "High" (lossless seemed too brutal over WAN connections.)
Enable RemoteFX encoding for RemoteFX clients designed for Windows Server 2008R2 SP1 = Enabled.

In \Remote Session Environment\Remote FX for Windows Server 2008R2

Configure Remote FX = Enabled
Optimize visual experience when using Remote FX = Enabled
    Set Screen capture rate (frames per second) = Highest (best quality)
    Set Screen Image Quality = Highest (best quality)
Optimize visual experience for remote desktop sessions = Enabled
    Set Visual Experience = Rich Multimedia

These changes correspond to the following registry entries:

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services]
"SelectTransport"=dword:00000000
"bEnumerateHWBeforeSW"=dword:00000001
"AVC444ModePreferred"=dword:00000001
"MaxCompressionLevel"=dword:00000000
"ImageQuality"=dword:00000002
"fEnableVirtualizedGraphics"=dword:00000001
"VGOptimization_CaptureFrameRate"=dword:00000001
"VGOptimization_CompressionRatio"=dword:00000001
"VisualExperiencePolicy"=dword:00000001

You can check this by browsing regedit or using the Powershell Command:

Get-Item "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services"

Other registry tweaks

Not all of the configurations were available with GPO, so some other registry tweaks are made in TurboRemoteFXHost.reg

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services]
"AVCHardwareEncodePreferred"=dword:0
"fEnableWddmDriver"=dword:00000000
; If issues, try WDDM driver enabled.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations]
"DWMFRAMEINTERVAL"=dword:15

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile]
"SystemResponsiveness"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TermDD]
"FlowControlDisable"=dword:00000001
"FlowControlDisplayBandwidth"=dword:0000010
"FlowControlChannelBandwidth"=dword:0000090
"FlowControlChargePostCompression"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]
"InteractiveDelay"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters]
"DisableBandwidthThrottling"=dword:00000001
"DisableLargeMtu"=dword:00000000