How to Change the Remote Desktop (RDP) Port

How to Change the Remote Desktop (RDP) Port

How to Change the Remote Desktop (RDP) Port

A guide to customizing the default RDP listening port on Windows Server.

By default, Remote Desktop listens on port 3389. Administrators often change this to enhance security ("security through obscurity") or to resolve port conflicts.

⚠️ CRITICAL WARNING:
Before you restart the service or the server, you MUST configure the Windows Firewall to allow traffic on the new port. Failure to do so will lock you out of the server remotely.

Method 1: The Manual Method (Registry + Firewall)

This method involves manually editing the Windows Registry and creating a new firewall rule.

Step 1: Modify the Registry

  1. Open the Registry Editor by pressing Win + R, typing regedit, and pressing Enter.
  2. Navigate to the following path:
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
  3. Locate the key named PortNumber in the right pane.
  4. Double-click it, select Decimal as the base, and type your new port number (e.g., 3390).
  5. Click OK.

Step 2: Update Windows Firewall

  1. Open Windows Defender Firewall with Advanced Security.
  2. Click on Inbound Rules > New Rule.
  3. Select Port and click Next.
  4. Select TCP and enter your specific local port (e.g., 3390).
  5. Select Allow the connection.
  6. Apply the rule to Domain, Private, and Public profiles (as needed).
  7. Name the rule (e.g., "RDP Custom Port 3390") and click Finish.

Step 3: Restart Service

Restart the server to apply changes. Alternatively, restart the Remote Desktop service:

Restart-Service TermService -Force

Method 2: Using PowerShell (Recommended)

This is the safest and fastest way, as it handles the registry and firewall in one go.

Run the following script as Administrator. (Replace 3390 with your desired port):

$port = 3390 # 1. Set the new port in Registry Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "PortNumber" -Value $port # 2. Create the Firewall Rule New-NetFirewallRule -DisplayName "RDP Custom Port $port" -Direction Inbound -LocalPort $port -Protocol TCP -Action Allow # 3. Restart the Service Restart-Service TermService -Force

How to Connect with a Custom Port

Once changed, you must specify the port number when connecting via Remote Desktop Connection (mstsc.exe).

Syntax: ServerIP:PortNumber

Example: 192.168.1.10:3390

Author Bio

Mr. Keloth leads technical implementation at RDS CAL Store. He specializes in Remote Desktop Services infrastructure, secure remote architecture, and helping IT teams seamlessly scale their official licensing.

Microsoft Certified Professional

MCSE MCSA MCTS MCP MCP+I A+ Security+

With over 20 years of experience deploying and managing enterprise Windows Server environments, Keloth leads technical implementation at RDS CAL Store. He specializes in Remote Desktop Services infrastructure, secure remote architecture, and helping IT teams seamlessly scale their official licensing.

Related Posts

Understanding RDS CAL Downgrade Rights

July 12, 2025

Home – Understanding RDS CAL Downgrade Rights Understanding RDS CAL Downgrade Rights When managing a Remote Desktop Services environment, hardware and software upgrades rarely happen all at once. You might purchase new Client Access Licenses (CALs) today, but still need them to authorize connections to older servers running in your datacenter. Microsoft accommodates this reality…

How to Disable Remote Desktop Easy Print in Windows Server (2016-2025)

July 12, 2025

Home – How to Disable Remote Desktop Easy Print in Windows Server (2016-2025) How to Disable Remote Desktop Easy Print in Windows Server (2016-2025) Remote Desktop Easy Print is the default driver Windows uses to map local client printers into a remote session. While convenient, it strips away advanced printer features (like stapling, tray selection,…

How to Create a Remote Desktop User in Windows Server (2016, 2019, 2022 & 2025)

July 12, 2025

Home – How to Create a Remote Desktop User in Windows Server (2016, 2019, 2022 & 2025) How to Create a Remote Desktop User in Windows Server (2016, 2019, 2022 & 2025) Provisioning remote access for a new employee requires more than just creating a standard Windows account. To securely connect to a Session Host,…

How to Fix the CredSSP “Encryption Oracle Remediation” RDP Error

July 12, 2025

Home – How to Fix the CredSSP “Encryption Oracle Remediation” RDP Error How to Fix the CredSSP “Encryption Oracle Remediation” RDP Error If you are managing Windows Servers, you have likely encountered this terrifying error message when trying to connect via Remote Desktop: “An authentication error has occurred. The function requested is not supported… This…