Change the RDP port (3389) on a Windows Server VPS
Windows' default RDP port is 3389, the first one bots try. Changing the RDP port of a Windows Server VPS cuts down these attempts, but it does not replace a well-configured firewall. This guide shows how to open the new port, edit the registry or use PowerShell, restart the service and reconnect.
Prepare the change
Pick a free port between 49152 and 65535, for example
54321. Avoid well-known ports such as 22, 443 or 8080.Follow the order. Firewall rule first, then the registry, then the service restart. Keep your RDP session open until the final test.
Keep a rescue access. The console on the VPS page in the client area shows the server screen without going through RDP.
Check that the chosen port is free. If the command shows nothing, no service is using it.
netstat -ano | findstr :54321
If you restart the RDP service before opening the new port in the firewall, you lose access. In that case, open the console with the Console button on the VPS page, then Open the console.

Open the new port in the firewall
Open PowerShell as administrator. RDP uses TCP, and UDP for a smoother display. Open both.
New-NetFirewallRule -DisplayName "RDP Custom Port" -Direction Inbound -Protocol TCP -LocalPort 54321 -Action Allow
New-NetFirewallRule -DisplayName "RDP Custom Port UDP" -Direction Inbound -Protocol UDP -LocalPort 54321 -Action Allow
With the GUI, open wf.msc, then Inbound Rules › New Rule…. Choose Port, TCP, enter 54321, keep Allow the connection on all three profiles, name the rule and click Finish. Windows labels are in English, the language of the delivered system.
On a OuiHeberg VPS, this firewall is the only one to configure. The client area has no network firewall. The guide How to open a port in Windows Firewall on a VPS has the details.
Change the port in the registry
Press
Win + R, typeregeditand press Enter.Paste this path into the editor's address bar.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-TcpDouble-click PortNumber, choose Decimal, replace
3389with your port and click OK.

The value is saved right away. It only applies once the service restarts.
Change the port with PowerShell
The same change, quicker to replay. Show the current port, change it, then check.
# Current port
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name PortNumber
# New port
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name PortNumber -Value 54321
# Check
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name PortNumber

Restart the Remote Desktop service
This command restarts the service without restarting the server.
Restart-Service -Name TermService -Force
Your RDP session drops. You can also use services.msc, right-click Remote Desktop Services, then Restart. A full restart with Restart-Computer works too.
Check and close the old port
Reconnect on the new port, then check that it is listening. The line 0.0.0.0:54321 should appear in the LISTENING state.
netstat -ano | findstr :54321
In Settings › System › Remote Desktop, the Remote Desktop port line also shows the new port.
Once the connection is confirmed, turn off the original rules for port 3389 and block it.
Disable-NetFirewallRule -DisplayName "Remote Desktop - User Mode (TCP-In)"
Disable-NetFirewallRule -DisplayName "Remote Desktop - User Mode (UDP-In)"
New-NetFirewallRule -DisplayName "Block RDP Default Port" -Direction Inbound -Protocol TCP -LocalPort 3389 -Action Block
Connect with the new port
Add the port after the IP address, separated by a colon.
Windows, with
mstsc: type203.0.113.10:54321in the Computer field. Show Options › Save As keeps the connection in an.rdpfile.Mac, iPhone or Android, with Windows App: edit the PC and add the port to PC name, for example
203.0.113.10:54321.Linux, with Remmina: type
203.0.113.10:54321in Server. On the command line, FreeRDP accepts the same form.
mstsc /v:203.0.113.10:54321
xfreerdp /v:203.0.113.10:54321 /u:Administrator
The guide Connect to a Windows VPS via RDP covers each app in detail.
Go further
Changing the port cuts down bot noise, not the risk. A targeted scan finds the new port quickly. Combine it with these measures.
Keep Network Level Authentication (NLA) on, with the command below.
Restrict the port to your known IP addresses with
-RemoteAddress.Do not use the
Administratoraccount day to day. The guide How to set up a new Windows VPS shows how to create a dedicated account.Set account lockout in
secpol.msc, Account Policies › Account Lockout Policy, for example after 5 attempts.The safest option is not to expose RDP at all. Connect to a VPN first, then use RDP on the private address.
# NLA
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name UserAuthentication -Value 1
# RDP port restricted to one address
New-NetFirewallRule -DisplayName "RDP Custom Port IP Restricted" -Direction Inbound -Protocol TCP -LocalPort 54321 -RemoteAddress 203.0.113.5 -Action Allow
If you add the address-restricted rule, turn off the RDP Custom Port rule, which is open to everyone. The guide Block RDP brute-force attacks goes further.
Fix problems
Cannot connect after the change
The firewall rule is missing or not enabled. From the console on the VPS page, list the RDP rules and create the rule again if needed.
Get-NetFirewallRule | Where-Object { $_.DisplayName -like "*RDP*" }
New-NetFirewallRule -DisplayName "RDP Custom Port" -Direction Inbound -Protocol TCP -LocalPort 54321 -Action Allow
The port is already in use
If netstat -ano | findstr :54321 shows a line before the change, another program holds the port. The last column gives its process ID. Choose another port.
The RDP service does not restart
Check the Service Control Manager and Remote Desktop logs.
Get-WinEvent -FilterHashtable @{LogName='System'; ProviderName='Service Control Manager'} -MaxEvents 20
Get-WinEvent -LogName "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational" -MaxEvents 20
You forgot the new port
Open the console from the VPS page and read it from the registry.
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name PortNumber
Need help?
Open a ticket from Tickets › Open a Ticket, or from the Contact support tile at the bottom of the VPS page. In the Related Service field, pick the VPS so the team saves time. You can also ask your question on the OuiHeberg Discord.
Windows Server 2025 with the license included, Remote Desktop access and management from the client area.
View plans →