Hướng dẫn thay đổi port Remote Desktop

Rate this post

Hướng dẫn thay đổi port Remote Desktop

Áp dụng cho: Windows Server 2022, Windows 10, Windows 8.1, Windows 8, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2008 R2

Khi bạn kết nối đến một máy tính (máy khách hoặc máy chủ chạy hệ điều hành Windows) thông qua Remote Desktop client, tính năng Remote Desktop trên máy tính của bạn “nghe” yêu cầu kết nối thông qua một cổng lắng nghe xác định (mặc định là 3389). Bạn có thể thay đổi cổng lắng nghe đó trên các máy tính chạy hệ điều hành Windows bằng cách chỉnh sửa registry.

Bắt đầu trình chỉnh sửa registry. (Gõ regedit vào ô Tìm kiếm.)
Điều hướng đến nhánh registry sau: HKEY_LOCAL_MACHINESystemCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp
Tìm giá trị PortNumber
Nhấp chuột phải và chọn Edit > Modify, sau đó nhấp chuột Decimal.
Nhập số cổng mới và nhấn OK.
Đóng trình chỉnh sửa registry và khởi động lại máy tính của bạn.
Lần kết nối tiếp theo với máy tính này bằng Remote Desktop, bạn phải nhập cổng mới. Nếu bạn đang sử dụng tường lửa, hãy đảm bảo cấu hình tường lửa cho phép kết nối vào số cổng mới.

Bạn có thể kiểm tra cổng hiện tại bằng cách chạy lệnh PowerShell sau:
PowerShell
Copy
Get-ItemProperty -Path ‘HKLM:SYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp’ -name “PortNumber”
Ví dụ:
PowerShell
Copy
PortNumber: 3389
PSPath: Microsoft.PowerShell.CoreRegistry::HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp
PSParentPath: Microsoft.PowerShell.CoreRegistry::HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStations
PSChildName: RDP-Tcp
PSDrive: HKLM
PSProvider: Microsoft.PowerShell.CoreRegistry

Bạn cũng có thể thay đổi cổng RDP bằng lệnh PowerShell sau. Trong lệnh này, chúng ta sẽ chỉ định số cổng RDP mới là 3390.
Để thêm một cổng RDP mới vào registry:
PowerShell
Copy
$portvalue = 3390
Set-ItemProperty -Path ‘HKLM:SYSTEMCurrentControlSetControl
Terminal Server
WinStationsRDP-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

Leave a Reply

Your email address will not be published. Required fields are marked *

Hotline: 03464.99999
Liên Hệ Chúng Tôi Nhắn tin Facebook Zalo: 03464.99999
This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.