The following is a guide to changing the RDP (Remote Desktop Protocol) port from powershell.
Open your powershell as admin
Then execute the command below. Replace xxxx with the port you want.
$portvalue = xxxx Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value $portvalue 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 |
If so, Enter until it appears that the RDP port has changed.
Additional:
For security reasons, please do not change your RDP port to the default 3389 as it is prone to brute force attacks.
This RDP port change to be perfect requires a reboot process
The above command can only run in Powershell.