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-
- Open theย Start Menu, search forย Registry Editor, and open it.
- Now, navigate to the following address-
-
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
-
- On the right side, double-click onย PortNumberย to edit it.ย
- Here, selectย Decimalย underย Base.ย
- Now, you will have to edit theย Value Data. Set theย Value Dataย to the RDP port you want to change to.
- 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-
- Press theย Windowsย key and typeย Windows PowerShell. Right-click on theย Windows PowerShellย and then click onย Run as Administrator.
- When the UAC prompt appears, click on theย Yesย button.ย
- 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-
- Press theย Windows key, type Windows Defender Firewall with Advanced Security, and pressย Enter.
- Click on theย Inbound Rulesย and then click onย Newย Rule.
- For theย Rule Type, selectย Portย and then click onย Next.
- When asked, โDoes this rule apply to TCP or UDP?โ selectย TCP.
- Selectย Specific local ports, type the new RDP port you have set, and then click onย Next.
- On the next screen, selectย Allow the connectionย and then continue by clicking onย Next.
- Please select whether the rule applies to Domain,ย Private,ย Public, or all of them.
- You must now enter the Nameย for the RDP port and description (optional). Click onย Finishย once done.ย
- 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.
- Press the Windows + Rย key combo, typeย services.msc, and click OK.
- 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-
- Launchย Windows PowerShellย as Administrator on your PC.
- 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.ย