Author : MD TAREQ HASSAN | Updated : 2022/08/25

Prerequisites

Enable remote desktop to the target PC Allow access to the target PC (the PC you want to connect remotely)

Setup static private IP for PC

Disable remote desktop from public network in Windows Firewall (we will use port forwarding feature of router)

Local security policy setting:

Local group policy setting:

Obscuring RDP port

Check current RDP port

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

Set custom RDP port

$portvalue = 3330
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value $portvalue
New-NetFirewallRule -DisplayName 'RDPCustomPort-TCPInbound' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portvalue
New-NetFirewallRule -DisplayName 'RDPCustomPort-UDPInbound' -Profile 'Public' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portvalue

Now, restart PC and then check the port again

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

Setup dynamic DNS in the router

Setup port forwarding in the router

Connect to PC using RDP client

From MacBook Pro