Change the Remote Desktop port safely

Open the new port in Windows Firewall first, change the RDP port in the registry, restart the service and connect on the new port.

  • Intermediate
  • Windows VPS · Admin RDP
  • 2 min read

By RunRacks Team · Published

On RunRacks Windows VPS and Admin RDP servers, Remote Desktop already listens on TCP port 12230 instead of the Windows default 3389 (see RunRacks RDP port 12230). Most people never need to change it. If you want a different port, for example to match a company policy, follow the steps below. The order matters: open the new port in the firewall first, then move RDP.

1. Pick a port

Choose an unused port between 1025 and 65535, for example 49833. Avoid ports used by software you run (such as 1433 for SQL Server or 8080 for web apps). This guide uses 49833.

2. Allow the new port in Windows Firewall

Open PowerShell as Administrator:

PowerShell
New-NetFirewallRule -DisplayName "RDP 49833 TCP" -Direction Inbound -Protocol TCP -LocalPort 49833 -Action Allow
New-NetFirewallRule -DisplayName "RDP 49833 UDP" -Direction Inbound -Protocol UDP -LocalPort 49833 -Action Allow

3. Change the RDP port

PowerShell
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name PortNumber -Value 49833
Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name PortNumber

4. Restart the Remote Desktop service

Restarting the service ends your current session, so check step 2 once more first. Then run:

PowerShell
Restart-Service -Name TermService -Force

If the command reports that dependent services are running, restart the server instead with Restart-Computer.

5. Connect on the new port

Add the port after the IP address with a colon:

PowerShell
mstsc /v:203.0.113.25:49833

In Windows App on Mac, iPhone or Android, enter 203.0.113.25:49833 as the PC name.

6. Close the old port

Once the new port works, disable the rule that allows the old port (12230 on a RunRacks server):

PowerShell
Get-NetFirewallPortFilter -Protocol TCP |
  Where-Object LocalPort -eq 12230 |
  Get-NetFirewallRule |
  Disable-NetFirewallRule

Troubleshooting

  • Timeout on the new port: open the browser console from the control panel, log in and check the rule with Get-NetFirewallRule -DisplayName "RDP 49833*".
  • Want to undo it: set PortNumber back to 12230, re-enable the 12230 rule (the same pipeline as step 6 with Enable-NetFirewallRule) and restart the service.

Next steps

Was this guide helpful?

Still stuck?

Ask RunRacks AI for a quick answer, or open a ticket and our team will take a look at your server.

Security

Check the Windows Firewall rule for RDP port 12230

Find and verify the inbound TCP 12230 rule that lets Remote Desktop reach your RunRacks server, recreate it if it was deleted and scope it without locking yourself out.

  • Intermediate
  • Windows VPS · Admin RDP
  • 5 min read

Security

iptables basics: list, allow, drop and save rules

Learn how iptables chains and rule order work, then build a small ruleset that allows SSH and web traffic, drops everything else and can be edited by line number.

  • Intermediate
  • Linux VPS
  • 6 min read