Replacing the default port 3389 of Windows Server via the registry
To change the default RDP port (3389) on Windows Server 2016/2019 through the registry, follow these steps:
- Open the Registry Editor by typing “regedit” in the search box in the Start menu or at the command prompt.
- Navigate to the following path:“HKEY_LOCAL_MACHINE\SYSTEM\ CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp”.
- Find the key named “PortNumber” and double-click on it.
- In the Value window, select Decimal and enter the new port number. For example, enter “5000” to change the port to 5000.
- Click OK to save the changes.
- Restart the server for the changes to take effect.