To change the default RDP port i.e 3389, we need to do only two things on our windows operating system.
First one, we have to make some changes i.e. (outgoing and incoming rule) in firewall.
Second one, we have to make changes in registry.
Firewall setting :-Follow these steps to make changes in Firewall.
1.Open firewall through cmd(firewall.cpl) or direct search firewall from search menu.
2.Go to advance setting and right click on inbound rule and then create a new rule.
3. Follow the next procedure from there and you can see also see in the picture below.
4. Click on Next, next until you finish the steps and name the rule. You have to do same thing in outbound rules also.
Registry changes:- Follow these steps to change the Remote Desktop server port.
1.Open up Registry Editor by clicking on the Start Button, type in regedit and then hit Enter.
2.In Registry Editor, navigate to HKEY_LOCAL_MACHINE, SYSTEM, CurrentControlSet, Control, Terminal Server, WinStations and RDP-Tcp.
3.Right click on the PortNumber dword and select Modify.
4.Change the base to Decimal and enter a new port between 1025 and 65535 that is not already in use.
5.Click OK and reboot
Make sure to reboot to activate the change.
Note:- Keep in mind that the next time you want to connect to your system with RDP you will need to provide the port number.You can do that from the Remote Desktop client by appending a colon after the host name or ip address followed by the port number. For example, if I have a computer with host name of supportmenepal with RDP running on port 12345 I would use supportmenepal:12345 in the remote desktop client hostname field.