Termsrv.dll Patch Windows Server 2016 ((better)) -

Understanding the termsrv.dll Patch for Windows Server 2016

What is it?

The termsrv.dll (Terminal Services DLL) is a critical system file in Windows Server 2016 that manages Remote Desktop Services (RDS). By default, Windows Server 2016 allows only two concurrent administrative remote desktop sessions (often called the "admin mode").

The so-called "termsrv.dll patch" is an unofficial modification to this file. Its purpose is to remove or increase the concurrent session limit, allowing multiple users to connect simultaneously via RDP without purchasing and installing Remote Desktop Session Host (RDSH) CALs (Client Access Licenses).

Why do people use it?

⚠️ Critical Warnings (Read Before Proceeding) termsrv.dll patch windows server 2016

  1. License Violation: Using this patch on a production server violates Microsoft’s End User License Agreement (EULA). Microsoft requires RDS CALs for each user or device beyond the two admin sessions.
  2. Security Risk: Patching system DLLs breaks Windows File Protection and can expose the server to instability, failed updates, or malware injection.
  3. No Official Support: Microsoft Support will not assist with any issues on a patched system. Windows Updates may revert the patch or cause boot failures.
  4. Audit Risk: In a business environment, license audits can lead to significant fines.

You assume all liability if you proceed.


Conclusion

The termsrv.dll patch for Windows Server 2016 offers a tempting way to unlock unlimited concurrent RDP sessions without licensing costs. For homelabs, testing, and non-critical internal tools, it remains a popular workaround. However, production environments should never rely on this hack.

By following the step-by-step manual patching guide above—backing up files, using the correct hex pattern, and understanding the risks—you can safely remove the two-session limit. Just remember: every Windows Update may break the patch, and Microsoft’s licensing team will not forgive violations.

If you truly need multi-user RDP, budget for RDS CALs. But for the tinkerer and the budget-conscious lab admin, the termsrv.dll patch lives on as a clever, if unsanctioned, solution. Understanding the termsrv


Method 1: Manual Hex Patching (Recommended)

This method gives you full control and works across all Server 2016 builds.

Conclusion

The termsrv.dll patch for Windows Server 2016 is a critical update that ensures the security, stability, and performance of Remote Desktop Services. Keeping these patches up to date is essential for administrators managing Windows Server environments, especially those with remote access configurations. Always follow best practices for applying updates, and be prepared to troubleshoot any issues that may arise.

5. Windows 10/11 Enterprise with RDP Patches (Workaround)


Step 1: Stop the Terminal Services Service

Open PowerShell as Administrator:

net stop TermService /y

2. Determine Patching Method

There are two ways to apply the patch: manually using a Hex Editor or automatically using a PowerShell script. The PowerShell method is recommended for accuracy. Development/Test Environments: To allow a small team to

Method A: PowerShell Script (Recommended) This script automatically finds the correct byte pattern in the DLL and replaces it.

  1. Open PowerShell ISE or Notepad.
  2. Paste the following script:
    $path = "C:\Windows\System32\termsrv.dll"
    # Define the byte patterns
    # Pattern for Windows Server 2016 (Usually builds 14393)
    $pattern = "39 81 3C 06 00 00 0F 84 7F 2C 01 00"
    $replace = "B8 00 01 00 00 89 81 38 06 00 00 90"
    # Read the file
    $bytes = [System.IO.File]::ReadAllBytes($path)
    # Convert pattern/replace to byte arrays
    $patternBytes = $pattern.Split(' ') | ForEach-Object  [Convert]::ToByte($_, 16) 
    $replaceBytes = $replace.Split(' ') | ForEach-Object  [Convert]::ToByte($_, 16)
    # Find and replace
    $found = $false
    for ($i = 0; $i -lt $bytes.Length - $patternBytes.Length; $i++) 
        $match = $true
        for ($j = 0; $j -lt $patternBytes.Length; $j++) 
            if ($bytes[$i + $j] -ne $patternBytes[$j]) 
                $match = $false
                break
    if ($match) 
            for ($k = 0; $k -lt $replaceBytes.Length; $k++) 
                $bytes[$i + $k] = $replaceBytes[$k]
    $found = $true
            Write-Host "Pattern found and patched at offset: $i"
            break
    if ($found) 
        [System.IO.File]::WriteAllBytes($path, $bytes)
        Write-Host "termsrv.dll patched successfully."
     else 
        Write-Host "Pattern not found. Your version might be different or already patched."
    
  3. Save the file as patch.ps1 and run it in PowerShell.

Method B: Manual Hex Editor If the script fails, you can use a Hex Editor (like HxD).

  1. Make a copy of termsrv.dll to your Desktop (editing it directly in System32 is often blocked).
  2. Open the copy in HxD.
  3. Press Ctrl+F and search for the Hex-values: 39 81 3C 06 00 00 0F 84 7F 2C 01 00
  4. Replace that string with: B8 00 01 00 00 89 81 38 06 00 00 90
  5. Save the file.
  6. Copy the modified file back to C:\Windows\System32, overwriting the original.

(Note: The byte pattern above applies to standard Windows Server 2016 builds. If your Windows Updates have updated termsrv.dll, the offsets may vary slightly. Common variations exist where 3C 06 might be 38 06.)


Risks and Drawbacks

Before proceeding, understand the consequences:

  1. EULA violation – The patch circumvents licensing, which is legally prohibited.
  2. No Microsoft support – Once patched, Microsoft will refuse support tickets related to RDP, licensing, or system stability.
  3. Windows Update breaks the patch – Cumulative updates often replace termsrv.dll, reverting the patch. You must reapply after each update.
  4. Security implications – Patching core system files disables Secure Boot integrity checks and may alert antivirus/EDR solutions.
  5. Stability risks – An incorrect patch version (wrong Windows build) can cause blue screens (SYSTEM_SERVICE_EXCEPTION) or RDP service failure.
  6. No RDS features – You still won’t get session virtualization, remote app publishing, or per-user roaming profiles.