# Change RDP Port

## Open Powershell

<figure><img src="https://3721258189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIV8zRtxst8QuSieBcPNv%2Fuploads%2FBUmizaHa1PC33REplrnK%2Fimage.png?alt=media&#x26;token=9d45c00c-c47c-43e6-851d-b594c4c91270" alt=""><figcaption></figcaption></figure>

### Please execute the commands below in PowerShell to modify the RDP port (replace '3389' with your desired port number).

{% code overflow="wrap" %}

```powershell
$rdpPort = 3389
$keyPath = "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
Set-ItemProperty -Path $keyPath -Name "PortNumber" -Value $rdpPort -Type DWORD
New-NetFirewallRule -DisplayName "Remote Desktop" -Direction Inbound -Protocol TCP -LocalPort $rdpPort -Action Allow -Enabled True
Restart-Service TermService -Force
```

{% endcode %}
