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 Jan 9 '19 at 19:27
  • See: stackoverflow.com/questions/9566052/… for some examples. – HelpingHand Jan 9 '19 at 19:42
  • @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 Jan 9 '19 at 19:58
  • 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 Jan 14 '19 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.