Is it possible to have a virtual mouse or keyboard in Remote Desktop Windows Server independent from my mouse?

Saeed Fazlollahzadeh 21 Reputation points

Hi, I searched a lot for this but did not found any solution.

I'm testing it with a simple HTML/JS counter button when I click on that button, it increments from 1 to infinite number.

I know when I connect to RDP, it uses my mouse and keyboard as input (I hope I'm right), and I tried some ways like writing a python script or using auto clicker apps. But my issue is if I close the session or even minimize it, the click in the session does not either work and it stops because of having no input.

I even tried with on-screen keyboard to simulate, but it doesn't work either.

Is there anyway or any apps or even in any programming language a way to click some where or using a virtual keyboard in RDP and it still working after closing the session?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,512 questions
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 16,551 Reputation points Microsoft Vendor

    Hello @Saeed Fazlollahzadeh ,
    Welcome to Microsoft Q&A!

    Here is a workaround, replace the current session with the console.

    1. Execute query session to view the currently logged in session.
    2. Execute tscon rdp-tcp#0 /dest:console. 260035-image.png

    rdp-tcp#0 is your RDP session.

    After the two commands are executed, you will be disconnected, but the keyboard and mouse will work normally. In my test, SetCursorPos returns Ture normally.

    Thank you.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful