0
How can I check
- from command line
- whether a server accepts RDP (windows remote desktop) connections?
- without using user/password login credentials
I am trying to run automated network sanity checks.
I know I can start a GUI remote desktop session to a host via
mstsc /v:<server_adress>
but this opens a GUI window, whose result (OK or can't connect via remote desktop) I yet can't get back to my checker script.
Is it sufficient to deem RDP is available if making a TCP connection to port 3389 succeeds? – HelpingHand – 2019-01-09T19:27:42.443
See: https://stackoverflow.com/questions/9566052/how-to-check-network-port-access-and-display-useful-message for some examples.
– HelpingHand – 2019-01-09T19:42:28.400@HelpingHand this heuristic is, what I am doing for now (easy with python). It may, however, give a false positive, if rdp Port is changed on Windows and the port used differently. This scenario seems unlikely, but is still possible. – hardmooth – 2019-01-09T19:58:02.333
If RDP port is changed mstsc would need the port added to it's the query to determine if RDP is present. You can run qwinsta to check RDP sessions on a remote computer if you have admin rights. It will tell you all of the sessions and whether the listener is running. So for your purposes, you would only need to look for "rdp-tcp 65536 Listen". None of these will tell you if the RDP is just not running, you'd have to query for the service, and chanch if it's auto/manual/disabled and whether or not it was currently running to do that. – Ben Personick – 2019-01-14T15:16:33.460