How to change RDP port
By default, Windows uses port 3389 for RDP (Remote Desktop Protocol), but it's recommended to change it for security and protection. You may also need to change the port in case you encounter the "An internal error has occurred" when connecting via RDP. In this manual, we will explain how to change the RDP port:
Step 1: RegeditOpen the Registry Editor
(regedit)on the server and navigate to the path
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Terminal Server/WinStations/RDP-Tcp.
Find the PortNumber key in this location. Then, switch to decimal format for input and set the new port for RDP connections.
In our example, we will change the port to 65515.
Open the element and change the value to 65515, then click OK.
If your Windows firewall is turned off, simply restart the server and connect using the new port, in this case, IP:65515. If the firewall is enabled on the server, see Step 3.
Step 3: Adding the Port to ExceptionsGo to Firewall --> Advanced settings and add an incoming rule --> Create a rule.
Rule Type --> Port
Protocol TCP --> Specify local ports and enter our port.
Action --> Allow the connection
Choose the profile as needed (or all profiles)
Provide a name for the rule
Add and restart the server, then use IP:PORT in your RDP connection.