Only Allow 1 user to Remote Desktop at a time (Windows 2019)

By default Windows 2019 allows 2 users to remote desktop at one time. Is there a way to restrict this even further to allow only 1 remote desktop user at a time? I tried the following tutorial, however I'm still able to remote desktop with 2 different users at the same time. https://support.managed.com/kb/a1816/how-to-enable-disable-multiple-rdp-sessions-in-windows-2012-2012-r2-2016-and-2019.aspx

Thank you in advance!


Solution 1:

I'm not sure if restricting RDP access to one user at a time is possible for Windows 2019. However, I came up with a workaround that works great. I created a scheduled task that will log off all other users when a user logs in. This way only one user can be logged in at a time. The scheduled task runs a batch script to accomplish this, here is the batch script if anyone is interested:

query session >session.txt  
for /f "skip=2 tokens=2,3," %%i in (session.txt) DO if not %USERNAME%==%%i logoff %%j  
del session.txt