You should be very careful when you modify the registry of Remote Desktop. This is because when you modify the registry incorrectly you are into serious issues. So, prevention is always better than cure! Now, before you modify the registry, do a backup. And if in case any problem occurs, you can always restore the registry.
Backing up and restoring the registry in Windows
In order to open the Registry Editor in Windows, press Windows + R keys together > then Run box opens and then type regedit in the box and click OK > then select Yes to User Account Control.
Now, the Registry Editor is open.
Find the following registry subkey and click them:
Now, find Edit menu and click Modify. Then click Decimal.
Here, the new port number should be entered and then click OK.
Now, close the Registry Editor and restart the computer.
As you connect the computer remotely, you would have to type the new port to access it. Also, before you connect the new port to the computer using the Remote Desktop connection, you would have to set the firewall.