Windows Server 2012 R2 - Change RDP Port

A possible cause of the error "Because of a protocol error detected at the client code 0x1104 this session will be disconnected' is a conflict between the port you're trying to use and one already in use on your system.

You can run the command netstat -ano | findstr ":9999" (where 9999 is your port number) to find the PID of any running process listening on your port. The last column in the netstat output is the PID of the process. Use a tool like Sysinternals Process Explorer to find the process using the PID. If its not your process, then you've found your conflict, in which case you should configure Remote Desktop to listen on another port.


Double check your ports. It appears the the original port I chose was in use by another application. After trying another port I was able to get it working.

References for anyone else running into this problem:

  • https://www.adminsub.net/tcp-udp-port-finder - tcp/udp registered ports
  • https://www.lisenet.com/2014/change-default-rdp-port-on-windows-server-20082012/ - good instructions on changing port, and increasing security of rdp

and the official Microsoft KB: https://support.microsoft.com/en-us/help/306759/how-to-change-the-listening-port-for-remote-desktop