Here I’m going to show steps to change the RDP default port in a server.
In my case, what happened was I have changed the RDP port in my azure environment and change the endpoint policy accordingly. Unfortunately, I was not able to RDP into my Azure VM and not able to connect through the Azure portal also.
Then I have added a another PC into the same resource group (Which will reflect the same subnet) and connect to the server registry remotely and edit that.
Here I’ll show two methods to change default RDP port a Server.
1. RDP Port Change – Locally
Go into registry and go to
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber
Select edit DWORD and select Decimal. You will see the port 3389 given and change that to the port which you want to change. Click OK to save.
2. How to Edit the Windows registry remotely
Open the Registry editor in another PC which is in same subnet. Go to File> Connect to network Registry.
Then select the PC or the saver name which you want to remotely connect.
Now you will be able to control the registry in the other server.
If you want to change the RDP port back to default or another port, now you should be able to do that by go into below location.
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber