Change Windows Server RDP Port | INTROSERV
EUR
european

EUR

usa

USD

English En
Ex. VAT Ex. VAT 0%

Change Windows Server RDP Port

Changing the port is necessary because leaving the default makes it easier for potential attackers to find opportunities to connect to the server. First you need to open the port.

You can open the port from the command line. Important! In the command below, instead of NEW_PORT, enter the number of the port you want to replace the default RDP port with.

netsh advfirewall firewall add rule name="Custom RDP Port" dir=in action=allow protocol=TCP localport=NEW_PORT

or in another way:

Then go to "Control Panel" - "Windows Firewall" - "Advanced Options"

In the window that appears, select "New rule"


Next, we indicate the port that you specified in paragraph 3, the rule that will be applied to connections to this port, network types (only local, or external too) and the name for the rule.


Change port

Open the registry editor, for this press Win + R and type regedit

Open the branch
HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Control \ TerminalServer \ WinStations \ RDP-Tcp

Select the PortNumber parameter, select Decimal and change the value for it to the number of the port that you plan to use, for example, 55555 (by default 3389)

Restart the Remote Desktop service

Changing the port number in the registry does not take effect right away. Restart the Remote Desktop service so the new port becomes active. Open PowerShell as administrator and run:

Restart-Service TermService -Force

Warning

Restarting the service ends all active Remote Desktop sessions on the server. On a production server it is safer to restart the whole server during a maintenance window.

Connect using the new port

From now on the server does not listen on the default port, so you have to specify the new port when you connect. Open the Remote Desktop client (mstsc), and enter the server address followed by a colon and the new port, for example 203.0.113.10:55555.

Close the default port 3389

After you confirm that the connection through the new port works, close the default port 3389. If you leave it open, the server is still reachable on the well-known RDP port, and changing the port gives almost no benefit.

Open Windows Defender Firewall with Advanced Security again, go to Inbound Rules, find the built-in rule "Remote Desktop - User Mode (TCP-In)" and disable it. Your custom rule for the new port stays in place, so access through the new port keeps working.

Tip

You can do the same from the command line by disabling the built-in Remote Desktop rule group:

netsh advfirewall firewall set rule group="remote desktop" new enable=No

VAT

  • Other

    Ex. VAT

    0%
  • austria

    Austria

    20%
  • Belgium

    Belgium

    21%
  • Bulgaria

    Bulgaria

    20%
  • Croatia

    Croatia

    25%
  • Cyprus

    Cyprus

    19%
  • Czech Republic

    Czech Republic

    21%
  • Denmark

    Denmark

    25%
  • Estonia

    Estonia

    22%
  • France

    France

    20%
  • Finland

    Finland

    24%
  • Germany

    Germany

    19%
  • Greece

    Greece

    24%
  • Hungary

    Hungary

    27%
  • Ireland

    Ireland

    23%
  • Italy

    Italy

    22%
  • Latvia

    Latvia

    21%
  • Lithuania

    Lithuania

    21%
  • Luxembourg

    Luxembourg

    17%
  • Malta

    Malta

    18%
  • Netherlands

    Netherlands

    21%
  • Poland

    Poland

    23%
  • Portugal

    Portugal

    23%
  • Romania

    Romania

    19%
  • Slovakia

    Slovakia

    20%
  • Slovenia

    Slovenia

    22%
  • Spain

    Spain

    21%
  • Sweden

    Sweden

    25%
  • USA

    USA

    0%
european
states
  • germany
  • Español
  • Italiano
  • Poland
  • Русский
  • Slovenski
  • Türkçe
  • ukraine
  • kingdom
  • French
  • Hrvatska
  • Other
  • Austria
  • Belgium
  • Bulgaria
  • Croatia
  • Cyprus
  • Czech Republic
  • Denmark
  • Estonia
  • Finland
  • France
  • Germany
  • Greece
  • Hungary
  • Ireland
  • Italy
  • Latvia
  • Lithuania
  • Luxembourg
  • Malta
  • Netherlands
  • Poland
  • Portugal
  • Romania
  • Slovakia
  • Slovenia
  • Spain
  • Sweden
  • USA