Overview
This article explains how to change the default Remote Desktop Protocol - RDP listening port on Windows Server 2025.
By default, Windows listens on TCP port 3389. Changing the port can reduce automated scanning and low-effort attacks, but it does not replace proper security controls.
Before You Begin
Requirements
- Local administrator access to the server
- Console access available in case of lockout
Choose a Port
- Select a TCP port between 1025 and 65535
- Avoid ports used by other services
- Record the selected port for documentation
Important: Do not close your current RDP session until the new port is confirmed working.
Step-by-Step - Change the RDP Port
Step 1 - Modify the Registry
1. Press Windows + R, type regedit, and press Enter.
2. Navigate to the following registry path:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
3. In the right pane, double-click PortNumber.
4. Select Decimal.
5. Enter your new port number (example: 3395).
6. Click OK.
Note: The value is a REG_DWORD. Always choose Decimal before entering the port.
Step 2 - Configure Windows Firewall
1. Open Windows Defender Firewall with Advanced Security.
2. Click Inbound Rules.
3. Click New Rule.
4. Select Port and click Next.
5. Select TCP.
6. Choose Specific local ports and enter your new port.
7. Select Allow the connection.
8. Choose the applicable profiles (Domain, Private, Public).
9. Name the rule (example: RDP - Custom Port 3395).
10. Click Finish.
Step 3 - Apply the Change
Option A - Restart the Server
- Reboot the server to activate the new port.
Option B - Restart Remote Desktop Services
- Open Services.
- Restart Remote Desktop Services.
- Allow dependent services to restart if prompted.
Step 4 - Connect Using the New Port
Use this format in Remote Desktop Connection:
ServerNameOrIP:Port
Example:
192.168.1.10:3395
Verification
Confirm the new port is listening:
netstat -an | find ":3395"
Replace 3395 with your chosen port.
Optional - Quick Registry Check via PowerShell
You can confirm the registry location exists with:
Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
Optional Hardening
- Disable inbound rules allowing TCP 3389 after verification
- Restrict access by source IP at firewall level
- Use VPN or secure tunnel solutions
- Implement multi-factor authentication
Rollback Procedure
1. Set PortNumber back to 3389(Decimal).
2. Ensure firewall rules allow TCP 3389.
3. Restart the server or Remote Desktop Services.
Summary
The default RDP port has been successfully modified and secured with updated firewall rules. Always verify connectivity before ending your administrative session.