All articles, Windows servers

Windows server 2012 change the default RDP port (3389)

Windows server 2012 change the default RDP port (3389)

To accomplish this task, you need to edit the operating system’s registry. Registry editing is done using a registry editor program, which you can launch by typing the ‘regedit’ command in the PowerShell console.

Windows server 2012 change the default RDP port (3389) 1 2

Next, you need to locate the RDP-Tcp section. The path to the section is as follows: HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Control -> Terminal Server -> WinStations -> RDP-Tcp:

Windows server 2012 change the default RDP port (3389) 2 2 1024x538

Then, open the PortNumber item. Next, switch to the decimal input format and set a new port for RDP connections.

Windows server 2012 change the default RDP port (3389) 3 2 1024x537

When choosing a new port for the connection, remember that there are several categories of ports based on their numbers:

  • Ports from 0 to 10213 are well-known ports assigned and controlled by the Internet Assigned Numbers Authority (IANA). Typically, these are used by various OS system applications.
  • Ports from 1024 to 49151 are registered ports assigned by IANA. They can be used for specific tasks.
  • Port numbers from 49152 to 65535 are dynamic (private) ports that can be used by any application or process for their work.

After changing the connection port, it’s essential to create a rule for the new port in Windows Firewall.

Note: If you don’t create a rule in Windows Firewall, you won’t be able to connect to the server via RDP.

Create a new rule.

Windows server 2012 change the default RDP port (3389) 4 2 1024x769

Select a port rule.

Windows server 2012 change the default RDP port (3389) 5 2 1024x764

Choose the TCP protocol and specify the port you set while editing the registry (in our example, the port number is 60001).

Windows server 2012 change the default RDP port (3389) 6 2 1024x767

In the next step, select the action type that describes the rule. Allow the connection.

Windows server 2012 change the default RDP port (3389) 7 2 1024x765

You need to specify the scope of the rule on the following step, which depends on where the server operates (workgroup, domain, or private access).

Windows server 2012 change the default RDP port (3389) 8 1024x768

In the final step, you need to choose a name for the rule.

Windows server 2012 change the default RDP port (3389) 9 1024x768

Reboot the server.

Now, when connecting to the server via RDP, use the new port. You should specify it immediately after the server’s IP address, separated by a colon.