当前位置:网站首页>There are many ways to confirm and modify the remote port number
There are many ways to confirm and modify the remote port number
2022-06-24 04:52:00 【shawyang】
How to confirm the remote port number , There are many ways , Here it is 3 Kind of
1、 Make sure the TermService Of pid, Re pass pid Confirm remote port
tasklist /svc|findstr "Term"
netstat -ano|findstr " Process number "
2、powershell To confirm , The principle is the same as above
$rdppid=(get-wmiobject win32_service | where { $_.name -eq 'termservice'}).processID
netstat -ano|findstr $rdppid|findstr LISTENING
3、Reg query To query ,16 Base number d3d yes 10 It's binary 3389
The resulting value is converted to 10 It can be done in decimal
set /a a=0xd3d
reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /s|findstr /c:"PortNumber" reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /s|findstr /c:"PortNumber" reg query "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server\WinStations\RDP-Tcp" /s|findstr /c:"PortNumber" reg query "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /s|findstr /c:"PortNumber" reg query "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Terminal Server\WinStations\RDP-Tcp" /s|findstr /c:"PortNumber" reg query "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /s|findstr /c:"PortNumber"
How to modify a remote port number , There are many ways
1、 Refer to the Microsoft official website documentation :( apply 2008R2/Win7 The above system )
give an example , Change it to 33899
$portvalue = 33899
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
2、 adopt reg add Command to change
give an example , Change it to 33899
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "PortNumber" /t REG_DWORD /d 33899 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v "PortNumber" /t REG_DWORD /d 33899 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server\WinStations\RDP-Tcp" /v "PortNumber" /t REG_DWORD /d 33899 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v "PortNumber" /t REG_DWORD /d 33899 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Terminal Server\WinStations\RDP-Tcp" /v "PortNumber" /t REG_DWORD /d 33899 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v "PortNumber" /t REG_DWORD /d 33899 /f
3、 Reference resources 3389 Windows Remote port modification tool
All the methods , After changing the remote port , You need to restart the remote service
The command to restart the remote service is powershell -c "& { restart-service termservice -force}"
But restarting the remote service is prone to unexpected situations , That is, restarting the remote service is a process of first shutting down and then starting , It is similar to restarting the machine , It is the process of turning off the machine before turning it on , If the first half gets stuck , In the second half there was no way .
To make sure that there is no risk , It is recommended to restart the machine after modifying the remote port .
Restart after restart mstsc Pay attention to the slogan at the end , Yes, of course , If you don't understand mstsc, There is one Simple software ( It is essentially the bottom layer of the call mstsc), But it's very simple 、 To use , You can also remember the password on your local computer , In the future, you can double-click it to access it remotely , Very convenient .
边栏推荐
- 『应急响应实践』LogParser日志分析实践
- 梯度下降法介绍-黑马程序员机器学习讲义
- Summary of Android interview questions in 2020 (intermediate)
- Specificity and correlation of Worthington deoxyribonuclease I
- 重新认识WorkPlus,不止IM即时通讯,是企业移动应用管理专家
- MySQL - SQL execution process
- 2020年Android面试题汇总(中级)
- How to change the IP address of ECS? What are the precautions for changing the IP address
- Verifying data models in golang
- Apipost interface assertion details
猜你喜欢

Facebook internal announcement: instant messaging will be re integrated

apipost接口断言详解

Zhang Xiaodan, chief architect of Alibaba cloud hybrid cloud: evolution and development of government enterprise hybrid cloud technology architecture
2020年Android面试题汇总(中级)

重新认识WorkPlus,不止IM即时通讯,是企业移动应用管理专家

Final summary of freshman semester (supplement knowledge loopholes)

Recognize workplus again, not only im but also enterprise mobile application management expert
Summary of Android interview questions in 2020 (intermediate)

SAP MTS/ATO/MTO/ETO专题之八:ATO模式2 D+空模式策略用85

C语言自定义类型的介绍(结构体,枚举,联合体,位段)
随机推荐
What is Ping? How can the server disable Ping?
event
An interface testing software that supports offline document sharing in the Intranet
Bi-sql insert into
What is the role of ECS? How does FTP connect to ECS configuration?
Let children learn the application essence of steam Education
How to control CDN traffic gracefully in cloud development?
Bi-sql basic cognition
Customer disaster recovery case - a MySQL database migration scheme
getAttribute 返回值为null
事件
Abnova fluorescence in situ hybridization (FISH) probe solution
How do ECS create FTP accounts? What should I pay attention to during creation?
Application practice of helium decentralized lorawan network in Tencent cloud IOT development platform
查找GBase 8c数据库当前索引?
Advantages of fixed assets management system
Verifying data models in golang
Bi-sql - Select
集成阿里云短信服务以及报签名不合法的原因
Facebook internal announcement: instant messaging will be re integrated