Xclick doesn't work on VPS when not looking

A much easier solution would be to do use tscon:

To avoid problems with RealUser commands, use the tscon utility to disconnect from Remote Desktop. tscon returns the control to the original local session on the remote computer, bypassing the logon screen. All programs on the remote computer continue running normally, including GUI tests.

To disconnect from Remote Desktop, run the following command on the remote computer (in the Remote Desktop window) as an Administrator:

%windir%\System32\tscon.exe RDP-Tcp#NNN /dest:console

where RDP-Tcp#NNN is the ID of your current Remote Desktop session, for example, RDP-Tcp#0. You can see it in the Windows Task Manager on the Users tab, in the Session column.

You will see the “Your remote desktop session has ended” message, and the Remote Desktop client will close. But all programs and tests on the remote computer will continue running normally.

Source:
https://ui.vision/howto/taskscheduler

2 Likes