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
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.
If you change the port before allowing it in the firewall, your next connection will fail. Keep the browser console from the control panel in mind as your way back in, and keep your current session open until you have tested the new port.
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:
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 Allow3. Change the RDP port
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 PortNumber4. Restart the Remote Desktop service
Restarting the service ends your current session, so check step 2 once more first. Then run:
Restart-Service -Name TermService -ForceIf 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:
mstsc /v:203.0.113.25:49833In 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):
Get-NetFirewallPortFilter -Protocol TCP |
Where-Object LocalPort -eq 12230 |
Get-NetFirewallRule |
Disable-NetFirewallRuleIf you later restrict RDP to your own IP address, apply the restriction to your new rules (for example Set-NetFirewallRule -DisplayName "RDP 49833 TCP" -RemoteAddress 198.51.100.10).
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
PortNumberback to12230, re-enable the 12230 rule (the same pipeline as step 6 withEnable-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.
Related guides
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
Linux Security: Using aide for File Integrity Monitoring on VPS
AIDE builds a checksum database of your system files and reports anything that changed. This guide installs it, creates a baseline, tunes the rules and schedules daily checks on a Linux VPS.
- Advanced
- Linux VPS
- 6 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