. . .

How to change RDP port in windows server 2016.

Step 1: Open Registry Editor.
a). Press 'Win + R' to open the Run dialog.
b). Type 'regedit' and press Enter to open the Registry Editor.

Step 2: Navigate to the RDP Port Registry Key.
* In the Registry Editor, navigate to the following key:-
[ “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp” ]

Step 3: Locate the “PortNumber” Entry.
* Look for the entry named 'PortNumber' on the right side of the Registry Editor.

Step 4: Change the Port Number.
a). Double-click on 'PortNumber' to open the Edit DWORD Value dialog.
b). Choose the Decimal base and enter the desired port number. For example, you might choose '3389' for a non-standard port.
c). Click OK to save the changes.

Step 5: Restart the Remote Desktop Services.
a). Open a Command Prompt with administrative privileges.
b). Run the following command to restart the Remote Desktop Services:-
[ “net stop termservice” ]
[ “net start termservice” ]

Step 6: Update Firewall Rules (if necessary).
* If you’re using Windows Firewall or any other firewall, update the rules to allow traffic on the new port.
* For Windows Firewall, open “Windows Defender Firewall with Advanced Security,” and update the Inbound Rules for Remote Desktop.

Step 7: Test the Connection.
Use the Remote Desktop client to connect to the server using the new port. Specify the port in the format 'hostname:port' (for e.g., 'example.com:3389').