How to change the listening port for Remote Desktop?

CK CK 3788 
Created at
Updated at  
702 0 0

Important Considerations Before You Start:

  • Administrator Rights: You must be logged in as an administrator.
  • Backup: It's always a good idea to back up your registry before making changes. You can do this by exporting the RDP-Tcp key (Step 2) before modifying it.
  • Port Availability: Choose a port number that isn't already in use by another application and is within the valid range (1024-65535). Common alternatives include 3390, 4000, 5000, etc.
  • Firewall: You must update your Windows Firewall (and any other network firewalls) to allow traffic on the new port.

 

For WindowsXP

1. Start Registry Editor. 
2. Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\Win\Stations\RDP-Tcp\PortNumber 
3. On the Edit menu, click Modify, and then click Decimal. 
4. Type the new port number, and then click OK.  
5. Quit Registry Editor.

 

 

For Windows2000 or Windows2003

1. Run Regedt32 and go to this key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\Win\Stations\RDP-Tcp
NOTE: The above registry key is one path; it has been wrapped for readability. 
 
2. Find the "PortNumber" subkey and notice the value of 00000D3D, hex for (3389). Modify the port number in Hex and save the new value. 

To change the port for a specific connection on the Terminal Server:• Run Regedt32 and go to this key: 
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\Win\Stations\connection
NOTE: The above registry key is one path; it has been wrapped for readability. 
 
3. Find the "PortNumber" subkey and notice the value of 00000D3D, hex for (3389). Modify the port number in Hex and save the new value.


If your OS version is Windows XP SP2 or higher, you have to check firewall setting. Basically every port is blocked by Microsoft Windows Firewall.
 

 

For Windows 10/11

Step 1: Open Registry Editor

1. Press Win + R to open the Run dialog.
2. Type regedit and press Enter.
3. Click Yes if prompted by User Account Control (UAC).

 

Step 2: Navigate to the RDP-Tcp Key

1. In the Registry Editor, navigate to the following path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp

You can copy and paste this path directly into the address bar of Regedit in Windows 10/11 for quicker navigation.

 

Step 3: Modify the PortNumber Value

1. In the right pane, locate the entry named PortNumber.
2. Double-click on PortNumber.
3. In the "Edit DWORD (32-bit) Value" window:

  • Select Decimal under Base. This is crucial! If you leave it as Hexadecimal, your port number will be incorrect.
  • In the "Value data" field, enter your desired new port number (e.g., 4000, 3390).
  • Click OK.

 

Step 4: Close Registry Editor

1. Close the Registry Editor window.

 

Step 5: Restart Your Computer

1. For the change to take effect, you must restart your computer.

 

Step 6: Update Windows Firewall Rules (Crucial!)

After restarting, your computer will now listen for RDP connections on the new port, but Windows Firewall will still be blocking it unless you update the rules.

 

You have a couple of options:

Option A: Using Windows Defender Firewall with Advanced Security (Recommended)

1. Press Win + R, type wf.msc, and press Enter. This opens "Windows Defender Firewall with Advanced Security."
2. In the left pane, select Inbound Rules.
3. Disable/Delete the Old RDP Rule:

  • Look for an existing rule named "Remote Desktop (TCP-In)" or similar, which usually allows port 3389.
  • Right-click it and select Disable Rule (or Delete if you're certain you won't revert to 3389).

4. Create a New Inbound Rule for Your New Port:

  • In the right pane (Actions), click New Rule....
  • Select Port and click Next.
  • Select TCP and then Specific local ports. Enter your new port number (e.g., 4000). Click Next.
  • Select Allow the connection and click Next.
  • Select the network profiles where this rule should apply (e.g., Domain, Private, Public - usually you'd want all three for RDP, but adjust based on your security needs). Click Next.
  • Give the rule a descriptive name (e.g., "Remote Desktop - New Port 4000") and an optional description. Click Finish.

 

Option B: Using PowerShell (Quicker for experienced users)

1. Right-click the Start button and select Windows Terminal (Admin) or PowerShell (Admin).
2. Run the following command, replacing [YourNewPort] with your chosen port number (e.g., 4000):
 

New-NetFirewallRule -DisplayName "Remote Desktop (New Port)" -Direction Inbound -Protocol TCP -LocalPort [YourNewPort] -Action Allow    

Example for port 4000:

New-NetFirewallRule -DisplayName "Remote Desktop (Port 4000)" -Direction Inbound -Protocol TCP -LocalPort 4000 -Action Allow    


3. (Optional) If you want to disable the old default RDP rule via PowerShell:

Disable-NetFirewallRule -DisplayName "Remote Desktop (TCP-In)"    

 

Step 7: Test the New Port

1. From another computer, open the Remote Desktop Connection client (mstsc.exe).
2. In the "Computer" field, enter your target computer's IP address or hostname followed by a colon and the new port number.

  • Example: 192.168.1.100:4000 or MyWindowsPC:4000

3. Click Connect and verify that you can establish an RDP session.

 

Connecting from Outside Your Local Network (If Applicable)

If you plan to connect to your computer from the internet, you will also need to configure port forwarding on your router to direct traffic from the internet on your chosen port to the internal IP address of your Windows computer on the same port. This step is specific to your router's make and model.

Tags MS Windows Tweak Remote Desktop Port Change SetBkMode Terminal Server Listening Port Change Facebook X
Comments 0
Similar posts
  1. Stop the system automatically rebooting after Windows Updates
    513
  2. Tweak DNS Errors Caching in Windows 2000 / XP
    523
  3. Increase bandwidth by tweaking QoS in Windows XP Pro
    700
  4. Editing your Web browser's settings for faster loading of pages
    1,105
  5. Firefox Web Tweaking
    376
  6. Windows XP Internet Connection Sharing: Port Forwarding Difficulties
    1,338
  7. Changing ANY user password without having to know the existing password
    1,445
  8. How to make application speed faster
    936
  9. How to elimiate the "Restore Previous Session" dialog when FireFox 2.0 starts
    409
  10. Remote Desktop not work after SP3 installation ?
    787
  11. Auto Admin Logon Registry Entry for Windows 7
    1,502
  1. Disconnect your RDP session when the screen saver activates on Windows 11
    539
  2. My Microsoft Windows Laptop is so Slow and Network Connectivity is NOT Stable
    2,262
  3. Enable/Disable IPv4 on Windows
    1,288
  4. Enable/Disable IPv6 on Windows
    1,735
  5. Check if a file exists from inside a batch file
    1,969
  6. File synchronization method using WinSCP script – downloading modified files from remote server, useful way to backup files through SSH
    1,428
  7. Auto Admin Logon Registry Entry for Windows 7
    1,502
  8. Remote Desktop not work after SP3 installation ?
    787
  9. How to make application speed faster
    936
  10. Changing ANY user password without having to know the existing password
    1,445
  11. Windows XP Internet Connection Sharing: Port Forwarding Difficulties
    1,338
  12. Editing your Web browser's settings for faster loading of pages
    1,105
  13. Increase bandwidth by tweaking QoS in Windows XP Pro
    700
  14. Tweak DNS Errors Caching in Windows 2000 / XP
    523
  15. Stop the system automatically rebooting after Windows Updates
    513
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    39
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    34
  3. How do I create animated background for Google Meet?
    20,611
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    244
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    94
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    157
  7. Array of arguments passed to script in PHP
    90
  8. Invalid Auction Storms in Ad Tech
    98
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    202
  10. The Two Clocks of Ad Server Architecture
    70
  11. Frequency Cap Architecture Overview
    514
  12. Collecting Proof-of-Play from 100,000 Screens
    146
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    287
  14. What is RedisVL?
    109
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    230
  16. TPU & GPU Cluster Management Tools
    243
  17. The Concept of Scaffolding in AI Agents
    233
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    582
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    258
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    339
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    202
  22. Machine Learning: Training vs. Ranking
    221
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    222
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    195
  25. Designing a Data Curation System Around a Vector Database
    220
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    256
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    656
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    195
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    216
  30. Understanding Data Lineage
    260