With more people using remote servers, it is now easier for hackers to hack into the system through the RDP port. The default port number is 3389, and most people keep it the same without finding the need to change it. Now, this default RDP port is already on the hackers’ radar, and they always try to get access to the remote computers through it. 

Once the hackers are in, your computer will be vulnerable to their attacks, and they may steal your data, track your activity online, and do things that one cannot even think of. You can change your default RDP port number for a Windows Server to something else to avoid it. 

But what will changing the RDP port do? The hacker always considers the RDP port 3389 because it is the default. But if your RDP port is changed and set to some other free port, then it will be difficult for them to know what’s your RDP port and gain access to the PC. This article will guide you through how to change the RDP port for a Windows server. 

Ways to Change RDP Port for a Windows Server

There are multiple ways to change the RDP port for a Windows Server. Though the process is quite easy, you will have to be careful while doing so. Follow the steps given below to change the RDP port-

1. Through Registry Editor

The first way to change the RDP port is through the Registry Editor. You can do it by following the steps given below-

  1. Open the Start Menu, search for Registry Editor, and open it. Registry-Editor from search bar
  2. Now, navigate to the following address-
    • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
  3. On the right side, double-click on PortNumber to edit it. 
  4. Here, select Decimal under Base
  5. Now, you will have to edit the Value Data. Set the Value Data to the RDP port you want to change to. Through Registry Editor
  6. Once done, click on OK to save the changes. 

2. Through PowerShell 

You can also run the PowerShell command to change the RDP port for the Windows server. To do so, follow the steps given below-

  1. Press the Windows key and type Windows PowerShell. Right-click on the Windows PowerShell and then click on Run as Administrator. type Windows PowerShell
  2. When the UAC prompt appears, click on the Yes button. 
  3. In the Windows PowerShell, execute the following command-
    • Set-ItemProperty -Path ‘HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp’ -Name ‘portnumber’ -Value [Port Number]

Note- You must replace [Port Number] with the port number you want to change. 

Implement the Changes in the RDP Port

You must implement the changes once you have changed the RDP port through the above steps. Configure the Windows firewall for the latest Port and restart the remote desktop services. Here’s how-

  1. Press the Windows key, type Windows Defender Firewall with Advanced Security, and press Enter. Windows Defender Firewall with Advanced Security
  2. Click on the Inbound Rules and then click on New Rule. Inbound Rules and then click on New Rule
  3. For the Rule Type, select Port and then click on Next. Rule Type, select Port and then click on Next
  4. When asked, ‘Does this rule apply to TCP or UDP?’ select TCP.
  5. Select Specific local ports, type the new RDP port you have set, and then click on Next. Specific local ports
  6. On the next screen, select Allow the connection and then continue by clicking on Next. Allow the connection
  7. Please select whether the rule applies to DomainPrivatePublic, or all of them. Domain, Private, Public
  8. You must now enter the Name for the RDP port and description (optional). Click on Finish once done. 
  9. We selected TCP in the fourth step above; once you have set the rule for TCP, follow the above steps again, but choose UDP instead of TCP.
  10. Press the Windows + R key combo, type services.msc, and click OK. search for services
  11. Search for Remote Desktop Services here. Right-click on this service, and then click on Restart

How to Check the RDP Port on Windows Server?

Once you have changed the RDP port, it is important to check whether the changes have been made. You can do this by following the steps given below-

  1. Launch Windows PowerShell as Administrator on your PC. type Windows PowerShell
  2. In the PowerShell, you must execute the command given below-
    • Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber"

Note- Look for the PortNumber here. The PortNumber should be the one you have set using the above steps; if it is, you have successfully changed the RDP port. 

Final Words

Once you have followed the above steps, the RDP port on the Windows server will be changed to the custom port instead of the default. Ensure you have followed all the steps carefully and not skip them. You can now use the new port to use the Remote Desktop Connection. 


Please enter your comment!
Please enter your name here