How to make my AWS EC2 RDP, to run even after closing the RDP from my computer? - windows

Please help me. I have an AWS EC2 RDP running Windows 10. I have installed a keyboard mouse recorder which repeates my activity and I want to run my recorded activity endlessly. But this works fine till I am connected to Remote Desktop Session. But Whenever I close Remote Desktop connection. The software process stops as well.

Related

How to open GUI application on Windows via SSH if no active user sessions?

I am working on a project where I need to run a few tests through SSH using an interactive GUI application on multiple Windows VMs. I have seen various other solutions here for launching the GUI application such as with psexec or running schtasks and a .bat file. I have tried all of that. Unfortunately, the only time the GUI opens is when there is an active user session. For example, if I do something like psexec -i 22 path\to\bat\file it will launch the GUI with my active RDP session. This will still work while I am disconnected, as the user session is still active. However, if I log out of the user session entirely and try the same (either with psexec or directly running a bat with schtask), it won't work. It will simply run the GUI application as a background process, as when I login again with RDP, the GUI isn’t present and it only shows as a background process in the task manager.
Is there a way to trigger an RDP or some GUI style user session to become active in a headless manner? If not, then is there a different way to execute my application, where the interactive GUI is available with SSH or other means of headless connection when there is no active user signed in?
The Windows VMs have OpenSSH server running for connections.
This question actually solved the other half of the puzzle for me, namely how to get SSH connections to use the interactive session. Here's how to keep an active interactive session open at all times. Note that depending on your use case you might explicitly need a multi-session windows installation, which is a different VM image in Azure for example.
Have the user you want these commands to run in log on automatically when windows boots. https://learn.microsoft.com/en-us/troubleshoot/windows-server/user-profiles-and-logon/turn-on-automatic-logon
Create a .bat file with the following contents somewhere (for me it's just on C:) tscon 1 /dest:console
In task scheduler, create a task that runs this bat file whenever a remote user disconnects.
Point 2-3 are not necessary if you never RDP into the autologon user. Whenever you RDP to this user, the console session moves from the autologon session to your RDP session, and this script just reattaches the console session back when you disconnect. This way, that user always has the console attached and thus has GUI available.

Freeze keyboard and mouse on Windows

I want to create a program for a computer lab. The computers in lab are running Windows 7 and are connected via LAN. The program should freeze keyboard and mouse when PC gets disconnected from LAN and also show a fullscreen message.
Currently I have created the first version of this program that works almost fine. It runs with startup. But the problem is that the users can kill it from Task Manager. I've tried running it as a windows service and it runs but cannot interact with desktop, so it cannot freeze the keyboard and mouse.
Any suggestions is appreciated. Thanks in advance.
So I finally solved it.
The reason my program could not interact with desktop is that it runs in Session 0.
This is because the Windows services run in session 0 and cannot directly interact with desktop. Here by interaction I mean receiving keyboard, mouse events and creating or accessing windows in user's desktop.
So I created a service that runs with SYSTEM account. It will create the "freezer process" in user's session. Also this process will run with SYSTEM account, so the normal user will not have privileges to kill.

Windows server 2012 Log Off a remote desktop session without locking the screen

As in title. Is there any way to achieve this?
I have problem, because when you close remote desktop, gui and whole interface is being locked and any gui based applications or my autoit scripts won't work (they are crashing constantly).
I tried using 'tscon.exe' but this works only on windows server 2008.
I have the same issue, and I resolved it doing the following:
Connect to RD to your server with user "A"
From the remote computer, connect to RD to localhost to user "B" (create it if necessary)
From the new session, run anything you need.
Disconnect the FIRST session, with user "A".
In this way, the session running with user "B" will not be locked, and it will continue running your GUI controls.
Log off means the current session (created by logging in during RDP) is terminated. What you want is to keep the Logon Session live but disconnect the RDP.
Why not use AutoLogon to boot into console and run the scripts? However if the screen locks or someone RDPs and disconnects, the problem you are facing will reoccur.
What I have is to keep GUI and whole windows interface alive when i close remote desktop. Session is alive but gui and whole workstation is getting locked everytime I close rd.

Microsoft RDP for mac has no resume and reconnects with new session each time after minimized

I have been using the Microsoft Remote Desktop 8.0.18 to work on Azure vms. Every time the rdp on the mac changes to minimized there is no way to get your current window back again. I click on the Windows RDP icon down on the task bar and only get prompted with the initialize connection screen. The causes the server to run out of rdp sessions and am forced to reset the vm. I am not a pro mac user so it is probably something simple I am missing.
Have you tried forcing an install of the new mac rdp client?
http://blogs.msdn.com/b/devfish/archive/2015/02/25/mac-remote-desktop-connection-error-connecting-to-azure-virtual-machine.aspx#10631510

Is a mouse click on a remote desktop possible using AutoIt or alternatives?

I want to write a script that involves mouse click and stuff. I am little confused though. Is there a way mouse clicks (in the form of x and y co-ordinates) would work on a VPS which is logged on, but disconnected from the client?
Example:
MouseClick("left",588, 268)
To my knowledge, these VPSes don't have their own native screen resolution. I have already written the script for my local pc and it's working fine on my resolution. But when tried with the VPS, it doesn't work.
PS: I am running the script from the remote desktop itself and not from my local pc. Please correct me if there's anything I am doing wrong :)
Update: For anyone still looking for an answer, consider installing a vnc server, that way the screen resolution you specify is preserved even when not connected to the server.
Ex: https://www.realvnc.com/en/connect/download/vnc/
It's relevant to almost any automation tool, not only AutoIt.
Remote Desktop has its own GUI context only if it's connected to the remote PC. But you can lose focus for a Remote Desktop window (without disconnection & without minimizing) and continue other local work.
The same effect takes place for VNC server software.
One team in our organization uses it for massive test runs automation: a master server creates a remote session for each test machine and keeps them all connected until tests passes.
Use ControlClick to have the mouse click over RDP connections, even when you're not connected. For some reason it can still be iffy for me, but at least it worked more so that Click which was none at all.

Resources