Windows 10 remote desktop multiple users

JMN-8308 asked Aug 19, '21 | JMN-8308 edited Aug 19, '21

Hi,

We have mulitple Windows 10 PC's on site for which we want remote users to access. These Win 10 PCs are shared by multiple users, BUT only one session at at time, so I'm not asking about multiple concurrent sessions.

We are going to setup a Remote Desktop Gateway for this. I know that we will need an RDS Device CAL for the Remote Desktop Service to be installed [probably on Server 2016].

We have a windows 10 Enterprise campus agreement but do I need any additional licenses for remote users to gain access to the Win10 PC's on site. [Multiple users to one device [not concurrently]].

Thanks,

JMNP.S. We have External Connector Licenses for our RDSH servers [can these be used for remote access to our windows 10 enterprise PC's aswell as the RDSH Apps etc??

remote-desktop-services

Comment

In this article, we’ll look at potential issues and workarounds that will allow you to enable Remote Desktop sessions for multiple users on Windows 10 and Windows 8/8.1.

As with earlier versions of the Windows operating system, Windows 10 and 8 restrict the use of Microsoft’s Remote Desktop Protocol [RDP] to one remote connection, preventing users from making multiple RDP connections.

The issue with multiple Remote Desktop Sessions on Windows 10 and 8

Attempting to initiate a second Remote Desktop session will cause any users working locally on the machine or logged in through an existing RDP session to be kicked out. The issue is not a result of the technical capabilities of Windows 10 but rather with the license agreement.

Now that we’ve determined the obstacles we’re facing, let’s consider two popular options you can use to enable multiple Remote Desktop users on Windows 10 and 8: either by using the RDP Wrapper Library application or by editing the termsrv.dll file.

Enabling multiple RDP Sessions in Windows

Note: Before you begin, it’s important to remember that both of these processes are in violation of the Microsoft License Agreement.

RDP Wrapper Library

This is the easier, or at least less tedious, option. The problem that arises when you modify termsrv.dll, is that when installing a new Windows 10 build or simply some security updates, the termsrv.dll file can sometimes be updated automatically. As a result, you will have to modify termsrv.dll using HEX Editor after every update.

The RDP Wrapper Library, on the other hand, will simply be loading the file with changed parameters, so after any updates, it will continue to work without any issues.

Follow these steps to use the RDP Wrapper Library to enable multiple user RDP sessions:

  1. Start by downloading the RDP Wrapper Library here. The latest version is 1.6.2. According to the developer page, this will be supported for all versions of Windows. The RDP Wrapper Library serves as a layer between SCM [Service Control Manager] and Terminal Services, and it not only enables support for multiple simultaneous RDP sessions, it also enables RDP Host support on Windows 10.

Figure 1. Screen capture from github.com

  1. To use the RDP Wrapper, you’ll first need to install the RDP Wrapper Library by running install.bat with Administrator privileges.

  1. Once the installation is complete, run RDPConfig.exe and first check that all elements in the Diagnostics section are green.

  1. Test the ability to run multiple Remote Desktop connections by opening a second RDP session. You should be now able to successfully enable Remote Desktop connections for multiple users on Windows 10 or Windows 8.

Modifying termsrv.dll

The alternative to using the RDP Wrapper is to replace the original termsrv.dll file, which can be found in the C:WindowsSystem32 directory. Before editing or replacing anything, it is recommended that you manually create a backup of the file. You can do this through the command line prompt [cmd.exe] with the following command:

Copy c:WindowsSystem32termsrv.dll termsrv.dll_backup

Follow these steps to modify termsrv.dll:

  1. First, you will need to become the owner of the termsrv.dll file and assign the Administrators group full rights to the file. Head into the Properties after right-clicking on the file. Then go to the Security tab and click on Edit. In the access list, find the local administrators group and give it full control over this file and save the changes.

  1. Now you need to stop the Remote Desktop service [TermService] in either the services.msc console or from the command prompt with the following:

Net stop TermService

  1. Now open the termsrv.dll file using any HEX editor [such as the freeware HxD editor] and search for the following line:

39 81 3C 06 00 00 0F 84 73 42 02 00

Replace this line with:

B8 00 01 00 00 89 81 38 06 00 00 90

Figure 2. Screen capture from mh-nexus.de

  1. Finally, save the termsrv.dll file and run TermService before attempting to run multiple Remote Desktop connections by opening a second RDP session.

Regardless of what method you chose, you should now be able to connect multiple user Remote Desktop sessions on Windows 10 and Windows 8. If you experience any issues enabling multiple RDP connections or have some helpful advice to contribute, please share with us in the comments section below.

If you’re interested in learning how to allow multiple RDP sessions for Windows Server 2012, 2016 or 2019, check out our next blog post in this series.

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 – 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’s session.

Another user is signed in. If you continue, they’ll be disconnected. Do you want to sign in anyway?

All desktop Windows versions [including Win 10 and 11] have a number of restrictions on the Remote Desktop Service usage:

  1. 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;
  2. 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;
  3. 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.

Actually, the number of simultaneous RDP connections on Windows is limited by the license [and not by any technical aspect]. Thus, this restriction doesn’t allow to create a terminal RDP server based on the workstation that can be used by multiple users. Microsoft’s logic is simple: if you need a terminal server – buy a Windows Server license, RDS CALs, install and configure the Remote Desktop Session Host [RDSH] role.

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.

Let’s consider two ways on how to allow simultaneous RDP connections on Windows 10 and 11: using the RDP Wrapper tool or patching the termsrv.dll system file.

RDP Wrapper: Enable Multiple RDP Sessions on Windows

The RDP Wrapper Library 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’t make any changes to the termsrv.dll file, it’s just loading termsrv library with the changed parameters.

Thus, the RDPWrap will work even in the case of termsrv.dll file update. It allows you not to be afraid of Windows updates.

You can download the RDP Wrapper from the GitHub repository //github.com/binarymaster/rdpwrap/releases [the latest available version of the RDP Wrapper Library is v1.6.2]. The project hasn’t been updated since 2017, but it can be used in all new builds of Windows 10 and even Windows 11.

The RDPWrap-v1.6.2.zip archive contains some files:

  • RDPWinst.exe — an RDP Wrapper Library install/uninstall the program;
  • RDPConf.exe — an RDP Wrapper configuration tool;
  • RDPCheck.exe —an RDP check utility [Local RDP Checker];
  • install.bat, uninstall.bat, update.bat — batch files to install, uninstall, and update RDP Wrapper.

To install RDPWrap, run the install.bat file as an administrator. The program will be installed to the C:\Program Files\RDP Wrapper directory.

After the installation is complete, run the RDPConfig.exe. 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.

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’t have any settings for your Windows 10 build.

The current version of the rdpwrap.ini file can be downloaded here //raw.githubusercontent.com/sebaxakerhtc/rdpwrap.ini/master/rdpwrap.ini

Manually copy the contents of this page to the “C:\Program Files\RDP Wrapper\rdpwrap.ini” file. Or download the file using the PowerShell cmdlet Invoke-WebRequest [you must first stop the Remote Desktop service]:

Stop-Service termservice -Force
Invoke-WebRequest //raw.githubusercontent.com/sebaxakerhtc/rdpwrap.ini/master/rdpwrap.ini -outfile "C:\Program Files\RDP Wrapper\rdpwrap.ini"

Restart your computer, run the RDPConfig.exe tool. Check that all items are green in the Diagnostics 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.

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.

The RDPWrap tool is supported in all Windows editions, so you can build your own terminal [RDS] server on any Windows device.

Also, RDP Wrapper allows to:

RDP Wrapper Not Working on Windows 10

In some cases, the RDP Wrapper tool doesn’t work as expected and you cannot to your Windows host using multiple RDP sessions.

If the utility showed [not supported] in the status section, then the rdpwrap.ini file doesn’t contain configuration for your Windows build. Update the rdpwrap.ini file as described above.

If the RDP Wrapper doesn’t 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?

The screenshot below shows that for my version of Windows 10 [10.0.19041.1320] there are two description sections:

[10.0.19041.1320] ….. [10.0.19041.1320-SLInit] …..

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.

If after installing security updates or upgrading the Windows 10 build, RDP Wrapper doesn’t work correctly, check if the “Listener state: Not listening” is displayed in the Diagnostics section.

Try updating the rdpwrap.ini file, and then reinstalling the service:

rdpwinst.exe -u
rdpwinst.exe -i

It happens that when you try to establish a second RDP connection under a different user account, you see a warning:

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.

In this case, you can use the Local Group Policy Editor [gpedit.msc] to enable the policy “Limit number of connections” under Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Connections section. Change its value to 999999.

Restart your computer to update the GPO and apply the settings.

Modify the Termsrv.dll to Enable Multiple RDP Sessions

To remove the restriction on the number of concurrent RDP user connections in Windows 10 without using rdpwrapper, you can replace the original termsrv.dll file. This is the main library file used by the Remote Desktop Service. The file is located in C:\Windows\System32 directory.

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:

copy c:\Windows\System32\termsrv.dll termsrv.dll_backup

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:

takeown /F c:\Windows\System32\termsrv.dll /A

SUCCESS: The file [or folder]: c:\Windows\System32\termsrv.dll now owned by the administrators group

Now grant the local administrators group Full Control permissions on the termsrv.dll file using the icacls.exe:

icacls c:\Windows\System32\termsrv.dll /grant Administrators:F

processed file: c:\Windows\System32\termsrv.dll Successfully processed 1 files; Failed processing 0 files.

After that, stop the Remote Desktop service [TermService] using the services.msc console or from the command prompt:

Net stop TermService

The Remote Desktop Services UserMode Port Redirector service stops with it.

Before moving on, you need to find out your version [build number] of Windows 10. Open the PowerShell console and run the command:

Get-ComputerInfo | select WindowsProductName, WindowsVersion

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:

Windows build Find the string Replace with
Windows 11 RTM [

21H2 – 22000.258]

39 81 3C 06 00 00 0F 84 4F 68 01 00  

B8 00 01 00 00 89 81 38 06 00 00 90

Windows 10 x64 21H2 39 81 3C 06 00 00 0F 84 DB 61 01 00
Windows 10 x64 21H1 39 81 3C 06 00 00 0F 84 2B 5F 01 00
Windows 10 x64 20H2 39 81 3C 06 00 00 0F 84 21 68 01 00
Windows 10 x64 2004 39 81 3C 06 00 00 0F 84 D9 51 01 00
Windows 10 x64 1909 39 81 3C 06 00 00 0F 84 5D 61 01 00
Windows 10 x64 1903 39 81 3C 06 00 00 0F 84 5D 61 01 00
Windows 10 x64 1809 39 81 3C 06 00 00 0F 84 3B 2B 01 00
Windows 10 x64 1803 8B 99 3C 06 00 00 8B B9 38 06 00 00
Windows 10 x64 1709 39 81 3C 06 00 00 0F 84 B1 7D 02 00

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:

39 81 3C 06 00 00 0F 84 2B 5F 01 00

and replace it with:

B8 00 01 00 00 89 81 38 06 00 00 90

Save the file and run the TermService.

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:

copy termsrv.dll_backup c:\Windows\System32\termsrv.dll

Patching Termsrv.dll on Windows Using PowerShell

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’t 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 [1809+] and Windows 11.

# Stop RDP service, make a backup of the termsrv.dllfile and change the permissions Stop-Service UmRdpService -Force Stop-Service TermService -Force $termsrv_dll_acl = Get-Acl c:\windows\system32\termsrv.dll Copy-Item c:\windows\system32\termsrv.dll c:\windows\system32\termsrv.dll.copy takeown /f c:\windows\system32\termsrv.dll $new_termsrv_dll_owner = [Get-Acl c:\windows\system32\termsrv.dll].owner cmd /c "icacls c:\windows\system32\termsrv.dll /Grant $[$new_termsrv_dll_owner]:F /C" # search for a pattern in termsrv.dll file $dll_as_bytes = Get-Content c:\windows\system32\termsrv.dll -Raw -Encoding byte $dll_as_text = $dll_as_bytes.forEach['ToString', 'X2'] -join ' ' $patternregex = [[regex]'39 81 3C 06 00 00[\s\S\S]{6}'] $patch = 'B8 00 01 00 00 89 81 38 06 00 00 90' $checkPattern=Select-String -Pattern $patternregex -InputObject $dll_as_text If [$checkPattern -ne $null] { $dll_as_text_replaced = $dll_as_text -replace $patternregex, $patch } Elseif [Select-String -Pattern $patch -InputObject $dll_as_text] { Write-Output 'The termsrv.dll file is already patch, exitting' Exit } else { Write-Output "Pattern not found " } # patching termsrv.dll [byte[]] $dll_as_bytes_replaced = -split $dll_as_text_replaced -replace '^', '0x' Set-Content c:\windows\system32\termsrv.dll.patched -Encoding Byte -Value $dll_as_bytes_replaced # comparing two files fc.exe /b c:\windows\system32\termsrv.dll.patched c:\windows\system32\termsrv.dll # replacing the original termsrv.dll file Copy-Item c:\windows\system32\termsrv.dll.patched c:\windows\system32\termsrv.dll -Force Set-Acl c:\windows\system32\termsrv.dll $termsrv_dll_acl Start-Service UmRdpService

Start-Service TermService

The complete script code is available in my GitHub repository at //github.com/maxbakhub/winposh/blob/main/termsrv_rdp_patch.ps1

To execute the script, download it to your computer. Change the PowerShell execution policy settings for the current session:

Set-ExecutionPolicy Bypass -Scope Process -Force

And run the script:

C:\users\root\desktop\termsrv_rdp_patch.ps1

The script can be run after installing Windows updates to immediately make changes to the termsrv.dll file [you don’t have to modify the termsrv.dll file in the HEX editor after each update installation].

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].

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.

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.

Video liên quan

Chủ Đề