Skip to content
In-house anti-DDoS, included on VPS, game servers and web hosting · hosted in France · cancel anytime See our plans
CloudFive
Log in

01

What the port changes, and what it does not

By default, Remote Desktop (RDP) listens on port 3389, over TCP and UDP. Bots scan the Internet constantly and try credentials on that port. Moving it to another number has a real but limited effect:

  • What it brings: far fewer automated attempts, so cleaner logs and less risk of strangers getting an account locked.
  • What it does not bring: a port scan finds the new number quickly. The port protects nothing if the password is weak.

Do the settings that matter first: an administrator account in your own name with a long password, Network Level Authentication (NLA) and a firewall that keeps Remote Desktop to your own IP addresses. They are described in securing a Windows VPS. Changing the port comes on top.

02

Before you start

  • Pick a free port. Avoid those of another service you use or plan to use, and the 49152 to 65535 range, which Windows uses for its outgoing connections. This command must return nothing for the chosen port (here 3390):
    Get-NetTCPConnection -LocalPort 3390 -ErrorAction SilentlyContinue
  • Keep a way back in: open the customer area console in a tab. It shows the VPS screen without going through Remote Desktop, and lets you put everything back if the connection does not return.
  • Take a snapshot from the customer area, to return to the previous state in one step. It does not replace a copy of your data off the VPS: see backing up a Windows VPS.
  • Work as administrator: every command runs in PowerShell opened with Run as administrator.
03

Step 1: open the new port in the firewall

Order matters. If you change the port before opening the firewall, Remote Desktop will listen on a blocked port after the restart, and you will be locked out. Create the inbound rules first, for TCP and UDP, with the commands from Microsoft's documentation:

$portValue = 3390
New-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portValue
New-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portValue
Get-NetFirewallRule -DisplayName 'RDPPORTLatest*' | Select-Object DisplayName, Enabled, Profile
  • The profile: Microsoft's documentation adds -Profile Public. Without that option, the rule applies to every profile (default value Any), which avoids a bad surprise if the VPS network adapter is not classified as Public.
  • Your addresses: if you had restricted Remote Desktop to your IP addresses, do the same on the new rules by adding for example -RemoteAddress 203.0.113.10 to each command. Otherwise the new port will be open to everyone.
  • Another firewall: if a firewall also filters traffic between you and the VPS (a company one, for example), the new port must be allowed there too.
04

Step 2: change the port in the registry and restart

The listening port is the PortNumber value of the key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp. Display it, then change it:

Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name 'PortNumber'
$portValue = 3390
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name 'PortNumber' -Value $portValue

With Registry Editor (regedit): open the same key, double-click PortNumber, select the Decimal base before typing the number (in hexadecimal, 3390 would become another port), then confirm.

Check one last time that the step 1 rules are enabled, then restart the VPS, as Microsoft instructs:

Restart-Computer

The session drops immediately. Allow a minute or two before reconnecting.

05

Step 3: connect with address:port

In Remote Desktop Connection (mstsc), enter the VPS IP address followed by a colon and the new port, for example 203.0.113.10:3390. Other Remote Desktop apps accept the same form. Remember to update your saved .rdp files.

If the connection fails, test the port from a Windows PC:

Test-NetConnection -ComputerName 203.0.113.10 -Port 3390

If TcpTestSucceeded is True, the port answers: check the username and password. If it is False, it means it is blocked or Remote Desktop is not listening: go through the console.

Once connected, the original Remote Desktop rules still let port 3389 through, where nothing listens any more. You can disable them:

Disable-NetFirewallRule -Name RemoteDesktop-UserMode-In-TCP,RemoteDesktop-UserMode-In-UDP

Rolling back from the console: set the value back to 3389, re-enable the original rules and restart.

Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name 'PortNumber' -Value 3389
Enable-NetFirewallRule -Name RemoteDesktop-UserMode-In-TCP,RemoteDesktop-UserMode-In-UDP
Restart-Computer
06

On CloudFive

CloudFive's Windows VPS, from €8.50 per month, comes with Windows Server, licence included, and Remote Desktop ready on port 3389: the address and username are on the VPS page.

  • The customer area console stays available whatever port you choose: it is this guide's safety net.
  • Snapshots are taken from the customer area, before each change of this kind.
  • Ryzen 9 9950X, DDR5, NVMe, dedicated IPv4 address and basic anti-DDoS protection included, in France, monthly with no commitment, with support in French 7 days a week.

Next steps: connecting over Remote Desktop from each device, and transferring files to the VPS.

07

Frequently asked questions

How do I change the RDP port on Windows Server?

First open the new port for TCP and UDP in the firewall with New-NetFirewallRule. Then change the PortNumber value of the key HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp, restart the server and connect with address:port.

Is changing the RDP port enough to secure a Windows VPS?

No. The change cuts down automated attempts, but a port scan quickly finds the new number. A long password, Network Level Authentication and a firewall restricted to your IP addresses remain essential.

How do I connect to Remote Desktop on another port?

Add the port after the address, separated by a colon, for example 203.0.113.10:3390, in Remote Desktop Connection or in another Remote Desktop app. Also update the .rdp files you have saved.

What if I can no longer connect after changing the port?

Open the console from the customer area, which does not depend on Remote Desktop. Check the firewall rule for the new port, or set PortNumber back to 3389, re-enable the original rules and restart.

Which port should I choose for Remote Desktop?

A free port, not used by another service on the VPS, and outside the 49152 to 65535 range that Windows uses for outgoing connections. Check that it is free with Get-NetTCPConnection before choosing it.

Support CloudFive AI

An answer right away, a real team behind it.

CloudFive AI answers you at any hour, in seconds. When it doesn’t know, or as soon as you ask, the team that runs the machines takes over. No offshore call centre.

  • TicketThe team replies in under 2 hours, 7 days a week.
  • CloudFive AIAt any hour, on ia.cloudfive.fr, Discord and in your customer area.
  • DiscordThe team, the AI and other customers, in the help channel.
  • Your data stays with usAI runs on our servers in France; e-mails, IPs and passwords are masked.
A ticket in the customer area: a customer’s question about a Minecraft plugin, and the CloudFive team’s reply
A real ticket in the customer area, answered by the team (demo account; shown in French).
CUSTOMER AREA · APP

Your servers.
At your fingertips.

Restart a server, watch its resources live, pay an invoice or open a ticket — and get an alert when something goes wrong.

  • The status of all your services at a glance
  • Blocked attacks, filtered traffic, monthly peak
  • A notification when a server goes down or an invoice is due

App coming soon · in the meantime, everything works in your browser at manager.cloudfive.fr

The CloudFive app: the list of your services, with their status
The CloudFive app: the home screen, your services’ status, blocked attacks and an invoice to pay