How to change default Windows Server RDP Port Print

  • 4

To change Windows Server default RDP port 3389 to your own port number, please follow below steps:

1) Open powershell in administrator mode.

2) Enter follow command in powershell:

$portvalue = 3490 (Change this to your own port number)

Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value $portvalue

3) Below lines are to open RDP port inbound direction in TCP and UDP protocol.

New-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portvalue
New-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portvalue

4) Check the port change status

Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber"

You will see the changed port number

PortNumber : 3490
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal
Server\WinStations\RDP-Tcp
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal
Server\WinStations
PSChildName : RDP-Tcp
PSDrive : HKLM
PSProvider : Microsoft.PowerShell.Core\Registry

5) Restart your Windows Server to access Remote Desktop with custom port number.

 

Source: https://learn.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/change-listening-port

 


Was this answer helpful?

« Back