Termsrv.dll Patch Windows Server 2022 -
Patching termsrv.dll on Windows Server 2022 to enable concurrent RDP sessions requires modifying system files. The most effective, automated approach is using specialized PowerShell patchers, such as TermsrvPatcher.
Disclaimer: Modifying termsrv.dll violates Microsoft EULA, may violate security policies, and could make your system unstable or unbootable. Always create a system restore point or backup before patching. This is typically for non-production lab environments. Recommended Approach: TermsrvPatcher (GitHub)
The TermsrvPatcher project by fabianosrc on GitHub provides a PowerShell script specifically designed to handle the required binary patching for Windows Server 2022 and other versions. Steps to Patch Download: Clone or download TermsrvPatcher.ps1 from GitHub.
Run as Administrator: Open PowerShell as Administrator and navigate to the folder containing the script. Execute: Run the script: powershell
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass .\TermsrvPatcher.ps1 Use code with caution. Copied to clipboard
Restart: The script will automatically stop the Remote Desktop Service (TermService), create a backup, patch the file, and restart the service. Restart the server if necessary. Alternative Method: RDP Wrapper Library
RDP Wrapper (by stascorp) is another option, but it often struggles with Windows Server 2022 due to frequent build updates. If using this, you must keep the rdpwrap.ini file updated with the latest offsets. Patching Logic (Technical Breakdown)
If patching manually (e.g., using a hex editor like HxD), the general goal is to find the hex pattern 39 81 3C 06 00 00 (which compares the RDP session limit) and replace the surrounding bytes to allow multiple sessions. Commonly Updated Patch for 2022/2024 Server DLLs: Target Pattern: 39 81 3C 06 00 00 Replacement: B8 00 01 00 00 89 81 38 06 00 00 90
Note: With every Windows Update (e.g., KB5022842), the specific byte offsets change, making automated script patches (like fabianosrc/TermsrvPatcher) more reliable than manual editing. If you want, I can: Show you how to verify your exact termsrv.dll version
Provide a script to create a system restore point before you start Explain how to revert the patch if RDP stops working Let me know which step you'd like to dive into next. Windows server 2022 21H2 10.0.20348.1547 support missing
Step 7: Test the Patch
Initiate a third RDP session from a different client. Open Task Manager on the server → Users tab. You should see three active sessions. termsrv.dll patch windows server 2022
To verify the limit change, run PowerShell:
Get-WmiObject -Class Win32_OperatingSystem | Select-Object *session*
The Danger Zone: Why you should think twice
While technically interesting, this practice comes with significant risks that are often overlooked in forum posts:
1. The "Blue Screen" Risk
termsrv.dll is a critical system file. If you patch it incorrectly, or if the patcher calculates the wrong offset after a Windows Update, the server might boot
Patching termsrv.dll on Windows Server 2022 is a method used to bypass the default limit of two concurrent administrative Remote Desktop (RDP) sessions without installing the full Remote Desktop Services (RDS) role and purchasing Client Access Licenses (CALs). How the Patch Works
The patch targets the termsrv.dll file located in C:\Windows\System32\, which is the core library managing Terminal Services. By modifying specific hex values within this file, you can disable the check that limits the number of active sessions.
Manual Method: Requires taking ownership of the file from TrustedInstaller, granting full control to the Administrators group, and using a hex editor like HxD or Tiny Hexer to replace specific byte patterns.
Automated Tools: Scripts like TermsrvPatcher on GitHub automate the process by stopping the TermService, modifying the file, and restarting the service.
RDP Wrapper: A popular alternative that works as a layer between the Service Control Manager and Terminal Services, leaving the original termsrv.dll file untouched. This is generally safer but often flagged as malware by antivirus software. Critical Considerations & Risks
fabianosrc/TermsrvPatcher: Patch termsrv.dll so that ... - GitHub
About. Patch termsrv.dll so that multiple remote users can open an RDP session on a non-Windows Server computer. Patching Microsoft's RDP service yourself - Sam Decrock Patching termsrv
termsrv.dll on Windows Server 2022 is generally used to bypass the default limit of two concurrent Remote Desktop (RDP) sessions without purchasing Remote Desktop Services (RDS) Client Access Licenses (CALs). While popular in home or testing environments, this method is not recommended for production servers due to security and stability risks. Methods for Windows Server 2022 RDP Wrapper Library
: Instead of modifying the system file directly, this tool acts as a layer between the Service Control Manager and Terminal Services. You often need to update the rdpwrap.ini
file manually with the correct offsets for your specific Windows Server 2022 build (e.g., version 10.0.20348.x Manual Hex Editing
: Advanced users can use hex editors to search for specific byte patterns (like 39 81 3C 06 00 00 ) and replace them to disable the session check. PowerShell Scripts : Open-source scripts like TermsrvPatcher
automate the process of taking ownership of the file, backing it up, and applying the patch. Critical Review & Risks Description
Modifying core system DLLs can leave your server open to exploits or malware. Adversaries sometimes use this exact technique for persistent unauthorized access. Patched files can cause the TermService
to fail to start, leading to a complete loss of remote access. Maintenance Windows Updates frequently overwrite termsrv.dll
, requiring you to re-patch the system after every major security update. Patching to bypass session limits is a violation of the Microsoft License Terms . For official use, you should install the Remote Desktop Session Host role and purchase appropriate CALs. Official Alternative (Group Policy) Windows server 2022 21H2 10.0.20348.1547 support missing
termsrv.dll on Windows Server 2022 is a method used to bypass the default limit of two concurrent administrative Remote Desktop (RDP) sessions without purchasing additional Remote Desktop Services (RDS) Client Access Licenses (CALs). This process involves modifying the system's terminal services library to allow multiple simultaneous connections. Methods for Patching
There are two primary ways to achieve multiple concurrent sessions: Step 7: Test the Patch Initiate a third
Server Software Component: Terminal Services DLL - MITRE ATT&CK® 28 Mar 2022 —
The termsrv. dll file, typically stored in %SystemRoot%\System32\ , is the default ServiceDll value for Terminal Services in HKLM\ MITRE ATT&CK® Windows server 2022 21H2 10.0.20348.1547 support missing 15 Feb 2023 —
Patching termsrv.dll on Windows Server 2022 is a manual workaround used to bypass licensing restrictions and enable multiple concurrent RDP sessions. While Windows Server editions naturally support multiple sessions if the Remote Desktop Session Host (RDSH) role is installed, this patch is often used when administrators want to avoid RDS licensing requirements or enable concurrent sessions on non-RDS-configured servers. Technical Overview
The patch involves modifying specific hex bytes within C:\Windows\System32\termsrv.dll that enforce the "single session per user" or "connection limit" rules.
Key File: termsrv.dll (The main library for Remote Desktop Services). Common Patch Hex (Windows 10/11/Server 2022): Find: 39 81 3C 06 00 00 Replace: B8 00 01 00 00 89 81 38 06 00 00 90
Note: These values change with Windows updates. Newer builds (like 24H2) require different strings, such as replacing 8B 81 38 06 00 00 39 81 3C 06 00 00 75 with B8 00 01 00 00 89 81 38 06 00 00 90 EB. Implementation Methods Windows server 2022 21H2 10.0.20348.1547 support missing
2. Take ownership & modify permissions (if needed)
takeown /f C:\Windows\System32\termsrv.dll
icacls C:\Windows\System32\termsrv.dll /grant administrators:F
For Server 2022
The community (mostly from forums like MDL (MyDigitalLife) and GitHub) has identified new offsets. The standard patching logic involves:
- Locating the function that enforces the
fSingleSessionPerUserorenforceLicenseLimit. - Changing a conditional jump (JZ/JNZ) to an unconditional jump, or nop-ing out the license check.
- Modifying the constant that holds
2(the max sessions) to a higher value.
Always verify you have the correct file version. Using a patch from Server 2019 on Server 2022 will corrupt the DLL.
The Ultimate Guide to the termsrv.dll Patch for Windows Server 2022: Enabling Simultaneous RDP Sessions
The Classic Approach (Pre-2022)
For Server 2016/2019, the patch looked like:
- Hex Search:
39 80 78 03 00 00 0F 84 - Replace with:
B8 00 00 00 00 89 81 38
3. Hex Editing
The actual patch involves using a Hex Editor (such as HxD or Tiny Hexer) to open termsrv.dll. The goal is to find the specific code pattern responsible for the single-session limitation and replace it with a "No-Op" or a jump instruction that bypasses the check.
Example Concept (Offsets vary by build):
In previous versions of Windows Server, the patch often involved changing a jne (jump if not equal) instruction to a jmp (unconditional jump) or a sequence of nop (no operation) instructions.
- Search for: A byte sequence often resembling
39 81 3C 06 00 00(this is an illustrative example; specific bytes change with OS updates). - Replace with: A sequence that modifies the conditional logic.
Because Windows Server 2022 receives regular cumulative updates, the specific hex offset (memory address) changes frequently. Using an automated patcher tool (often open-source scripts found on platforms like GitHub) is generally preferred over manual hex editing, as these scripts can dynamically locate the correct byte patterns for the installed OS version.