I want to create a batch script that outputs all of my current rdp connections. I am connected to multiple machines from my desktop, but lose connection to them every so often. Eventually, I'd like to schedule this task to run regularly and notify me so that I can go in a reconnect. For reference, I am using a non-admin account.
Update:
With the query posted below (found in another stackoverflow post), I am able to get a list of all connections listening in on port 3389. In a limited use environment, these should only be RDP connections.
netstat -n -a | findstr 3389 >"C:\Users\Public\log.txt"
Edit 1: Reworded question.
Edit 2: Found temporary solution.
Original question:
The goal is to to schedule a task that checks a PC every XX minutes to see if it is connected to some VM's via Remote Desktop Connection. If it isn't connected to the right VM, then attempt to reconnect. I understand that I will need to schedule a batch file to run every XX minutes, then have the batch file check the connections (the hard part). I have looked around and I cannot find a clear answer as to whether this is even possible.