{"id":8903,"date":"2021-11-16T02:32:00","date_gmt":"2021-11-16T00:32:00","guid":{"rendered":"https:\/\/tajdini.net\/blog\/?p=8903"},"modified":"2022-07-26T14:49:13","modified_gmt":"2022-07-26T12:49:13","slug":"how-to-allow-multiple-rdp-sessions-in-windows-10-and-11","status":"publish","type":"post","link":"https:\/\/tajdini.net\/blog\/windows-and-server\/how-to-allow-multiple-rdp-sessions-in-windows-10-and-11\/","title":{"rendered":"How to Allow Multiple RDP Sessions in Windows 10 and 11?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Remote users can connect to their Windows 10 and 11 computers via the Remote Desktop Services (RDP). It is enough to enable RDP in the device settings and connect to the computer using any Remote Desktop client. But there is a restriction on the number of simultaneous RDP sessions \u2013 only one remote user can work simultaneously. If you try to open a second RDP session, a warning will appear asking you to disconnect the first user\u2019s session.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Another user is signed in. If you continue, they\u2019ll be disconnected. Do you want to sign in anyway?<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">All desktop Windows versions (including Win 10 and 11) have a number of restrictions on the Remote Desktop Service usage:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>You can remotely connect via RDP only to higher Windows editions (Professional and Enterprise). In Windows Home and Single Language editions the incoming remote desktop connections are forbidden;<\/li><li>Only one simultaneous RDP connection is supported. When you try to open a second RDP session, the user is prompted to close the active connection;<\/li><li>If there is a user who works on the console of the computer (locally), then when you try to create a new remote RDP connection, the console session will be disconnected. A remote RDP session will be also forcibly disconnected if the user will try to log in locally.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"376\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/windows11-dosnt-allow-multiple-rdp-disconnect-current-user-9864312.jpeg\" alt=\"\" class=\"wp-image-8904\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/windows11-dosnt-allow-multiple-rdp-disconnect-current-user-9864312.jpeg 400w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/windows11-dosnt-allow-multiple-rdp-disconnect-current-user-9864312-300x282.jpeg 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Actually, the number of simultaneous RDP connections on Windows is limited by the license (and not by any technical aspect). Thus, this restriction doesn\u2019t allow to create a terminal RDP server based on the workstation\u00a0that can be used by multiple users. Microsoft\u2019s logic is simple: if you need a terminal server \u2013 buy a Windows Server license, RDS CALs, install and configure the Remote Desktop Session Host (RDSH) role.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Technically, any Windows version with a sufficient amount of RAM can support the simultaneous operation of several dozens of remote users. On average, 150-200 MB of RAM is required for one user session (excluding running apps). Those, the maximum number of simultaneous RDP sessions is theoretically limited only by computer resources.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s consider two ways on how to allow simultaneous RDP connections on Windows 10 and 11: using the <strong>RDP Wrapper<\/strong> tool or patching the <strong>termsrv.dll<\/strong> system file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Contents:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>RDP Wrapper: Enable Multiple RDP Sessions on Windows<\/li><li>RDP Wrapper Not Working on Windows 10<\/li><li>Modify the Termsrv.dll to Enable Multiple RDP Sessions<\/li><li>Patching Termsrv.dll on Windows Using PowerShell<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>. System modifications described in the article are considered as a violation of the Microsoft License Agreement&nbsp; and you may perform them at your own risk.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2_1\">RDP Wrapper: Enable Multiple RDP Sessions on Windows<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>RDP Wrapper Library<\/strong> OpenSource project allows you to enable multiple RDP sessions on Windows 10 without replacing the termsrv.dll file. This tool works as a layer between SCM (Service Control Manager) and the Remote Desktop Services. RDPWrap allows you to enable not only support for multiple simultaneous RDP connections but also to build an RDP server on Windows Home editions. RDP Wrapper doesn\u2019t make any changes to the termsrv.dll file, it\u2019s just loading termsrv library with the changed parameters.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thus, the RDPWrap will work even in the case of termsrv.dll file update. It allows you not to be afraid of Windows updates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Important<\/strong>. Before installing RDP Wrapper, it is important to make that you are using the original (unpatched) version of the termsrv.dll file. Otherwise, RDP Wrapper may become unstable or not start at all.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can download the RDP Wrapper from the GitHub repository <a href=\"https:\/\/github.com\/binarymaster\/rdpwrap\/releases\">https:\/\/github.com\/binarymaster\/rdpwrap\/releases<\/a> (the latest available version of the RDP Wrapper Library is v1.6.2). The project hasn\u2019t been updated since 2017, but it can be used in all new builds of Windows 10 and even Windows 11.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The RDPWrap-v1.6.2.zip<\/strong> archive contains some files:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>RDPWinst.exe<\/strong> \u2014 an RDP Wrapper Library install\/uninstall the program;<\/li><li><strong>RDPConf.exe<\/strong> \u2014 an RDP Wrapper configuration tool;<\/li><li><strong>RDPCheck.exe<\/strong> \u2014an RDP check utility (Local RDP Checker);<\/li><li><strong>install.bat, uninstall.bat, update.bat<\/strong> \u2014 batch files to install, uninstall, and update RDP Wrapper.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"417\" height=\"190\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/RDPWrap-v1.6.2-install-3349149.jpeg\" alt=\"\" class=\"wp-image-8905\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/RDPWrap-v1.6.2-install-3349149.jpeg 417w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/RDPWrap-v1.6.2-install-3349149-300x137.jpeg 300w\" sizes=\"auto, (max-width: 417px) 100vw, 417px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To install RDPWrap, run the <strong>install.bat<\/strong> file as an administrator. The program will be installed to the <em>C:\\Program Files\\RDP Wrapper<\/em> directory.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"499\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/installing-rdp-wrapper-library-in-windows10-2015595.jpeg\" alt=\"\" class=\"wp-image-8906\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/installing-rdp-wrapper-library-in-windows10-2015595.jpeg 680w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/installing-rdp-wrapper-library-in-windows10-2015595-300x220.jpeg 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After the installation is complete, run the <strong>RDPConfig.exe<\/strong>. Most likely, immediately after installation, the tool will show that the RDP wrapper is running (Installed, Running, Listening), but not working. Note the red warning [not supported]. It reports that this version of Windows 10 (ver. 10.0.19041.1320) is not supported by the RDPWrapper.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"387\" height=\"327\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/windows-rdp-wrapper-not-supported-issue-1887923.jpeg\" alt=\"\" class=\"wp-image-8907\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/windows-rdp-wrapper-not-supported-issue-1887923.jpeg 387w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/windows-rdp-wrapper-not-supported-issue-1887923-300x253.jpeg 300w\" sizes=\"auto, (max-width: 387px) 100vw, 387px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The fact is that for each version of Windows 10 there must be a description in the rdpwrap.ini configuration file. Your config file simply doesn\u2019t have any settings for your Windows 10 build.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The current version of the rdpwrap.ini file can be downloaded here <a href=\"https:\/\/raw.githubusercontent.com\/sebaxakerhtc\/rdpwrap.ini\/master\/rdpwrap.ini\">https:\/\/raw.githubusercontent.com\/sebaxakerhtc\/rdpwrap.ini\/master\/rdpwrap.ini<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Manually copy the contents of this page to the \u201cC:\\Program Files\\RDP Wrapper\\rdpwrap.ini\u201d file. Or download the file using the PowerShell cmdlet Invoke-WebRequest (you must first stop the Remote Desktop service):<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Stop-Service termservice -Force<br>Invoke-WebRequest https:\/\/raw.githubusercontent.com\/sebaxakerhtc\/rdpwrap.ini\/master\/rdpwrap.ini -outfile \"C:\\Program Files\\RDP Wrapper\\rdpwrap.ini\"<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"374\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/rdp-wrapper-update-rdpwrap-ini-3746106.jpeg\" alt=\"\" class=\"wp-image-8908\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/rdp-wrapper-update-rdpwrap-ini-3746106.jpeg 512w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/rdp-wrapper-update-rdpwrap-ini-3746106-300x219.jpeg 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Restart your computer, run the RDPConfig.exe tool. Check that all items are green in the <strong>Diagnostics<\/strong> section and the caption [Fully supported] appears. The screenshot below shows that the RDP Wrapper with this new config works fine on Windows 11 as well.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"584\" height=\"248\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/using-rdpwrapper-on-windows-11-4255053.jpeg\" alt=\"\" class=\"wp-image-8909\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/using-rdpwrapper-on-windows-11-4255053.jpeg 584w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/using-rdpwrapper-on-windows-11-4255053-300x127.jpeg 300w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Try to establish several RDP sessions to your computer (use any RDP client: mstsc.exe, rdcman, etc.). It worked out well (you can even use saved RDP credentials)! Now your Windows 10 allows two (and more) remote users to use different RDP sessions simultaneously.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"475\" height=\"321\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/multiple-RDP-sessions-on-Windows-10-6948363.jpeg\" alt=\"\" class=\"wp-image-8910\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/multiple-RDP-sessions-on-Windows-10-6948363.jpeg 475w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/multiple-RDP-sessions-on-Windows-10-6948363-300x203.jpeg 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/multiple-RDP-sessions-on-Windows-10-6948363-110x75.jpeg 110w\" sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The RDPWrap tool is supported in all Windows editions, so you can build your own terminal (RDS) server on any Windows device.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, RDP Wrapper allows to:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Enable Remote Desktop;<\/li><li>The option <strong>Hide users on logon screen<\/strong> allows you to hide the list of users from the Windows Logon Screen;<\/li><li>If you disable the <strong>Single session per user<\/strong> option, multiple simultaneous RDP sessions will be allowed under the same user account (the registry parameter <strong>fSingleSessionPerUser<\/strong> =\u00a0 0 is set under the reg key <code>HKLM\\SYSTEM\\ CurrentControlSet\\Control\\Terminal Server\\fSingleSessionPerUser<\/code>);<\/li><li><strong>RDP Port<\/strong> \u2014 you can change the Remote Desktop port number from TCP 3389 to any other;<\/li><li>In the <strong>Session Shadowing Mode<\/strong> section, you can configure the remote control (shadow) connection mode to RDP sessions.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You can set limits on the duration of RDP sessions using the GPO.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2_2\">RDP Wrapper Not Working on Windows 10<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In some cases, the RDP Wrapper tool doesn\u2019t work as expected and you cannot to your Windows host using multiple RDP sessions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the utility showed [not supported] in the status section, then the rdpwrap.ini file doesn\u2019t contain configuration for your Windows build. Update the rdpwrap.ini file as described above.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the RDP Wrapper doesn\u2019t work after updating the rdpwrap.ini file, try opening the rdpwrap.ini file and looking for a description section for your Windows version. How to know if there is support for your version of Windows in the rdpwrapper config file?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The screenshot below shows that for my version of Windows 10 (10.0.19041.1320) there are two description sections:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[10.0.19041.1320]\n\u2026..\n\n[10.0.19041.1320-SLInit]\n\n\u2026..<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"650\" height=\"283\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/adding-section-to-rdpwrap-ini-3785511.jpeg\" alt=\"\" class=\"wp-image-8911\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/adding-section-to-rdpwrap-ini-3785511.jpeg 650w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/adding-section-to-rdpwrap-ini-3785511-300x131.jpeg 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If there is no section in the config file for your version of Windows, try using Google to search for the rdpwrap.ini strings for your Windows build. Add the lines you find to the end of the file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, if you have problems with RDPWrapper, you can open the issue at <a href=\"https:\/\/github.com\/stascorp\/rdpwrap\/issues\">https:\/\/github.com\/stascorp\/rdpwrap\/issues<\/a>. Here you can also find the actual rdpwrap.ini file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If after installing security updates or upgrading the Windows 10 build, RDP Wrapper doesn\u2019t work correctly, check if the \u201cListener state: Not listening\u201d is displayed in the Diagnostics section.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"397\" height=\"141\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/rdp-wrapper-not-listening-8618124.jpeg\" alt=\"\" class=\"wp-image-8912\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/rdp-wrapper-not-listening-8618124.jpeg 397w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/rdp-wrapper-not-listening-8618124-300x107.jpeg 300w\" sizes=\"auto, (max-width: 397px) 100vw, 397px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Try updating the rdpwrap.ini file, and then reinstalling the service:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>rdpwinst.exe -u<br>rdpwinst.exe -i<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It happens that when you try to establish a second RDP connection under a different user account, you see a warning:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">The number of connections to this computer is limited and all connections are in use right now. Try connecting later or contact your system administrator.<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"607\" height=\"206\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/rdp-warning-number-connections-to-this-computer-is-limited-7419308.jpeg\" alt=\"\" class=\"wp-image-8913\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/rdp-warning-number-connections-to-this-computer-is-limited-7419308.jpeg 607w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/rdp-warning-number-connections-to-this-computer-is-limited-7419308-300x102.jpeg 300w\" sizes=\"auto, (max-width: 607px) 100vw, 607px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In this case, you can use the Local Group Policy Editor (gpedit.msc) to enable the policy \u201c<strong>Limit number of connections<\/strong>\u201d under Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Connections section. Change its value to 999999.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"669\" height=\"583\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/policy-Limit-number-of-rdp-connections-6888762.jpeg\" alt=\"\" class=\"wp-image-8914\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/policy-Limit-number-of-rdp-connections-6888762.jpeg 669w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/policy-Limit-number-of-rdp-connections-6888762-300x261.jpeg 300w\" sizes=\"auto, (max-width: 669px) 100vw, 669px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Restart your computer to update the GPO and apply the settings.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2_3\">Modify the Termsrv.dll to Enable Multiple RDP Sessions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To remove the restriction on the number of concurrent RDP user connections in Windows 10 without using rdpwrapper, you can <strong>replace<\/strong> the original <strong>termsrv.dll <\/strong>file. This is the main library file used by the Remote Desktop Service. The file is located in <strong>C:\\Windows\\System32<\/strong> directory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before you edit or replace the termsrv.dll file, it is advisable to create its backup copy. This will help you to revert to the original version of the file if necessary. Open the elevated command prompt and run the command:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>copy c:\\Windows\\System32\\termsrv.dll termsrv.dll_backup<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then you need to take ownership of the file. To change the owner of a file from TrustedInstaller to the local Administrators group using the command:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>takeown \/F c:\\Windows\\System32\\termsrv.dll \/A<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SUCCESS: The file (or folder): c:\\Windows\\System32\\termsrv.dll now owned by the administrators group<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now grant the local administrators group Full Control permissions on the termsrv.dll file using the icacls.exe:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>icacls c:\\Windows\\System32\\termsrv.dll \/grant Administrators:F<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">processed file: c:\\Windows\\System32\\termsrv.dll Successfully processed 1 files; Failed processing 0 files.<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"208\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/termsrv.dll-takeown-grant-access-546189.jpeg\" alt=\"\" class=\"wp-image-8915\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/termsrv.dll-takeown-grant-access-546189.jpeg 909w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/termsrv.dll-takeown-grant-access-546189-300x69.jpeg 300w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/termsrv.dll-takeown-grant-access-546189-768x176.jpeg 768w\" sizes=\"auto, (max-width: 909px) 100vw, 909px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After that, stop the Remote Desktop&nbsp;service (<strong>TermService<\/strong>) using the <strong>services.msc<\/strong> console or from the command prompt:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Net stop TermService<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Remote Desktop Services UserMode Port Redirector service stops with it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"734\" height=\"573\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/TermService-9008866.jpeg\" alt=\"\" class=\"wp-image-8916\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/TermService-9008866.jpeg 734w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/TermService-9008866-300x234.jpeg 300w\" sizes=\"auto, (max-width: 734px) 100vw, 734px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Before moving on, you need to find out your version (build number) of Windows 10. Open the PowerShell console and run the command:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Get-ComputerInfo | select WindowsProductName, WindowsVersion<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In my case, Windows 10 build 21H1 is installed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then open the termsrv.dll file using any HEX editor (for example, Tiny Hexer). Depending on your Windows build, you need to find and replace the string according to the table below:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Windows build<\/strong><\/td><td><strong>Find the string<\/strong><\/td><td><strong>Replace with<\/strong><\/td><\/tr><tr><td>Windows 11 RTM ( 21H2 \u2013 22000.258)<\/td><td>39 81 3C 06 00 00 0F 84 4F 68 01 00<\/td><td>&nbsp; &nbsp; &nbsp; &nbsp; B8 00 01 00 00 89 81 38 06 00 00 90 &nbsp;<\/td><\/tr><tr><td>Windows 10 x64 21H2<\/td><td>39 81 3C 06 00 00 0F 84 DB 61 01 00<\/td><\/tr><tr><td>Windows 10 x64 21H1<\/td><td>39 81 3C 06 00 00 0F 84 2B 5F 01 00<\/td><\/tr><tr><td>Windows 10 x64 20H2<\/td><td>39 81 3C 06 00 00 0F 84 21 68 01 00<\/td><\/tr><tr><td>Windows 10 x64 2004<\/td><td>39 81 3C 06 00 00 0F 84 D9 51 01 00<\/td><\/tr><tr><td>Windows 10 x64 1909<\/td><td>39 81 3C 06 00 00 0F 84 5D 61 01 00<\/td><\/tr><tr><td>Windows 10 x64 1903<\/td><td>39 81 3C 06 00 00 0F 84 5D 61 01 00<\/td><\/tr><tr><td>Windows 10 x64 1809<\/td><td>39 81 3C 06 00 00 0F 84 3B 2B 01 00 &nbsp;<\/td><\/tr><tr><td>Windows 10 x64 1803<\/td><td>8B 99 3C 06 00 00 8B B9 38 06 00 00 &nbsp;<\/td><\/tr><tr><td>Windows 10 x64 1709<\/td><td>39 81 3C 06 00 00 0F 84 B1 7D 02 00 &nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Tiny Hexer editor cannot edit termsvr.dll file directly from system32 folder. Copy it to your desktop, and after modification replace the original file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, my build of Windows 10 x64 is 21H1 (19043.1320) with the termsrv.dll file version 10.0.19041.1320. Open the termsrv.dll file in Tiny Hexer, then find the text:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>39 81 3C 06 00 00 0F 84 2B 5F 01 00<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">and replace it with:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>B8 00 01 00 00 89 81 38 06 00 00 90<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"644\" height=\"348\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/Tiny-Hexer-5448100.jpeg\" alt=\"\" class=\"wp-image-8917\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/Tiny-Hexer-5448100.jpeg 644w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/Tiny-Hexer-5448100-300x162.jpeg 300w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file and run the TermService.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If something goes wrong and you experience some problems with the Remote Desktop service, stop the service and replace the modified termsrv.dll file with the original version:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>copy termsrv.dll_backup c:\\Windows\\System32\\termsrv.dll<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2_4\">Patching Termsrv.dll on Windows Using PowerShell<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In order not to modify the termsrv.dll file manually using a HEX editor, you can use the following PowerShell script to apply the patch automatically. This script is based on the Windows PowerShell version and doesn\u2019t work on modern PowerShell Core. The script is universal and can be used to patch the termsrv.dll file on all editions of Windows 10\u00a0(1809+) and Windows 11.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code># Stop RDP service, make a backup of the termsrv.dllfile and change the permissions<br>Stop-Service UmRdpService -Force<br>Stop-Service TermService -Force<br>$termsrv_dll_acl = Get-Acl c:\\windows\\system32\\termsrv.dll<br>Copy-Item c:\\windows\\system32\\termsrv.dll c:\\windows\\system32\\termsrv.dll.copy<br>takeown \/f c:\\windows\\system32\\termsrv.dll<br>$new_termsrv_dll_owner = (Get-Acl c:\\windows\\system32\\termsrv.dll).owner<br>cmd \/c \"icacls c:\\windows\\system32\\termsrv.dll \/Grant $($new_termsrv_dll_owner):F \/C\"<br># search for a pattern in termsrv.dll file<br>$dll_as_bytes = Get-Content c:\\windows\\system32\\termsrv.dll -Raw -Encoding byte<br>$dll_as_text = $dll_as_bytes.forEach('ToString', 'X2') -join ' '<br>$patternregex = ([regex]'39 81 3C 06 00 00(\\s\\S\\S){6}')<br>$patch = 'B8 00 01 00 00 89 81 38 06 00 00 90'<br>$checkPattern=Select-String -Pattern $patternregex -InputObject $dll_as_text<br>If ($checkPattern -ne $null) {<br>$dll_as_text_replaced = $dll_as_text -replace $patternregex, $patch<br>}<br>Elseif (Select-String -Pattern $patch -InputObject $dll_as_text) {<br>Write-Output 'The termsrv.dll file is already patch, exitting'<br>Exit<br>}<br>else {<br>Write-Output \"Pattern not found \"<br>}<br># patching termsrv.dll<br>[byte[]] $dll_as_bytes_replaced = -split $dll_as_text_replaced -replace '^', '0x'<br>Set-Content c:\\windows\\system32\\termsrv.dll.patched -Encoding Byte -Value $dll_as_bytes_replaced<br># comparing two files<br>fc.exe \/b c:\\windows\\system32\\termsrv.dll.patched c:\\windows\\system32\\termsrv.dll<br># replacing the original termsrv.dll file<br>Copy-Item c:\\windows\\system32\\termsrv.dll.patched c:\\windows\\system32\\termsrv.dll -Force<br>Set-Acl c:\\windows\\system32\\termsrv.dll $termsrv_dll_acl<br>Start-Service UmRdpService<br>Start-Service TermService<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The complete script code is available in my GitHub repository at <a href=\"https:\/\/github.com\/maxbakhub\/winposh\/blob\/main\/termsrv_rdp_patch.ps1\">https:\/\/github.com\/maxbakhub\/winposh\/blob\/main\/termsrv_rdp_patch.ps1<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To execute the script, download it to your computer. Change the PowerShell execution policy settings for the current session:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Set-ExecutionPolicy Bypass -Scope Process -Force<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And run the script:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>C:\\users\\root\\desktop\\termsrv_rdp_patch.ps1<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"650\" height=\"176\" src=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/patching-termsrv-dll-with-poweshell-script-4335332.jpeg\" alt=\"\" class=\"wp-image-8918\" srcset=\"https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/patching-termsrv-dll-with-poweshell-script-4335332.jpeg 650w, https:\/\/tajdini.net\/blog\/wp-content\/uploads\/2022\/07\/patching-termsrv-dll-with-poweshell-script-4335332-300x81.jpeg 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The script can be run after installing Windows updates to immediately make changes to the termsrv.dll file (you don\u2019t have to modify the termsrv.dll file in the HEX editor after each update installation).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The advantage of the method of enabling multiple RDP sessions in Windows 10 or 11 by replacing the termsrv.dll file is that antiviruses do not respond to it (unlike the RDPWrap, which is detected by many antiviruses as a Malware\/HackTool\/Trojan).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The main drawback is that you will have to manually edit the termsrv.dll file each time you upgrade the Windows 10 build (or when updating the version of the termsrv.dll file during the installation of monthly cumulative updates). And if you are using RDPWrapper, you will also need to update the rdpwrap.ini file after installing Windows updates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this article, we looked at how to remove the restriction on the number of simultaneous RDP user connections and run a free terminal server on desktop versions of Windows.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Remote users can connect to their Windows 10 and 11 computers via the Remote Desktop Services (RDP). It is enough to enable RDP in the device [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8921,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[235],"tags":[180,176],"class_list":["post-8903","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows-and-server","tag-rdp","tag-windows"],"_links":{"self":[{"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/posts\/8903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/comments?post=8903"}],"version-history":[{"count":2,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/posts\/8903\/revisions"}],"predecessor-version":[{"id":8920,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/posts\/8903\/revisions\/8920"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/media\/8921"}],"wp:attachment":[{"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/media?parent=8903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/categories?post=8903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tajdini.net\/blog\/wp-json\/wp\/v2\/tags?post=8903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}