Windows伺服器如何修改3389遠端端口,以及修改超級管理員密碼

如何修改Windows伺服器的3389遠端連接埠與超級管理員密碼

使用Windows伺服器時,修改預設的3389遠端端口以及超級管理員密碼是提升系統安全性的重要步驟。預設的3389端口是遠端桌面連接的標準端口,修改後可以有效降低遭受暴力破解攻擊的風險。本教學將詳細介紹如何在Windows伺服器上,並安全地更改超級管理員密碼。透過簡單的步驟,你可以確保伺服器的安全性更上一層樓。

Windows伺服器如何修改3389遠端端口,以及修改超級管理員密碼

 

1. 修改3389遠端桌面端口

修改3389埠可以透過修改註冊表來完成,以下是詳細步驟:

1.1 開啟登錄編輯器
1. 按下Win + R 鍵,開啟運行視窗。
2. 輸入 regedit,然後按Enter,開啟登錄編輯程式。

1.2 導航到遠端桌面連接埠設置
在登錄編輯器中,依序展開以下路徑:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp

注意:以上兩個位置都需要更改。

1.3 修改連接埠號
1. 找到PortNumber 字段,雙擊它。
2. 將數值從3389 修改為你想設定的新連接埠(例如:3390)。
3. 點選確定以儲存變更。

Windows伺服器如何修改3389遠端端口,以及修改超級管理員密碼

1.4 更新防火牆設置
確保新的連接埠在Windows防火牆中開放:
1. 開啟控制台,選擇系統與安全性> Windows Defender 防火牆。
2. 點選進階設定。
3. 在左側選擇入站規則,然後選擇新規則。
4. 選擇端口,點選下一步。
5. 選擇TCP,並輸入新的連接埠號碼(例如:3390),然後點選下一步。
6. 選擇允許連接,繼續點選下一步,為規則命名並完成設定。

 

Windows伺服器如何修改3389遠端端口,以及修改超級管理員密碼Windows伺服器如何修改3389遠端端口,以及修改超級管理員密碼

 

1.5 重啟伺服器
為了使更改生效,重啟你的Windows伺服器。

2. 修改超級管理員密碼

更改超級管理員密碼可以透過以下方式完成:

2.1 使用“電腦管理”
1. 右鍵點選“電腦” 或“此電腦”,選擇“管理”。
2. 在左側的選單中,找到並展開「本機使用者和群組」 > 「使用者」。
3. 找到「Administrator」 帳戶,右鍵點選它,選擇「設定密碼」。
4. 在彈出的對話框中輸入新密碼,確認後點選確定。

2.2 使用命令提示符
你也可以透過命令提示字元修改密碼:
1. 按下Win + R 鍵,輸入 cmd,按Enter 開啟命令提示字元。
2. 輸入以下指令並回Enter:

net user Administrator 新密碼

替換新密碼為你想要設定的密碼。

3. 確認設定成功

3.1 測試遠端連接
在另一台電腦上,開啟遠端桌面連線(mstsc),輸入 伺服器IP:新連接埠(如 192.168.1.100:3390),測試是否能夠成功連線。

3.2 確認管理員密碼更改
使用管理員帳號登入,確認新密碼能夠正常使用。

透過本教程,你已經成功修改了Windows伺服器的3389遠端桌面連接埠和超級管理員密碼。這些步驟不僅提高了伺服器的安全性,也讓你更能管理系統。如果需要了解更多關於Windows伺服器管理的內容,請關注我們的後續文章。

Win7/2008+設定IP、防火牆、遠端桌面及連接埠、設定密碼等設定腳本

@echo off & color 0A setlocal enabledelayedexpansion mode con cols=100 lines=50 :: ***************************************************************************** :: ** Author : Saiwa :: ** Email : 93959@163. Time 20163. Time 20163. Time 2023: 3:009 :70 0:009 : 063. : 2022-12-28 13:29 :: ** Filename : windows_tools.cmd :: ** Description : Win7/2008+設定IP、防火牆、遠端桌面及連接埠、設定密碼等:: ***************************************************************************** 活動代碼"tokens=1-2 delims= " %%a in ('chcp ^| findstr "936"') do ( set "code=%%b" ) if defined code ( goto cn ) else goto en tle:tle 207/Tool 207/ool 207/ool 203:208 20 月 20 月 203 月 203 月。全域變數,設定DNS set dns1=8.8.8.8 set dns2=8.8.4.4 set "input_error=輸入有誤,請重新輸入..." set "port_error=輸入錯誤,範圍:1024-65535 請重新輸入..." set ver=Vgoto :: ================================================================================================================================================================================================================================================== echo========================================================== echo 1 1 4 echoo 配置工具[!ver 5 檢視修改遠端桌面連接埠號碼echo 6 設定administrator的密碼echo 7 設定防火牆允許指定連接埠號碼echo 6 設定administrator的密碼echo 7 設定防火牆允許指定連接埠編號echo 8 阻止高風險連接埠和開啟遠端桌面echo 9 使用speedtest_cli命令行測速echo a 使用iperf3命令行測速,「選購節點echo q 回車後退出echo -------------------------- 1. IP設定只適用於閘道是IP段最後一個可用IP :rechoice echo. set choice=init set /p choice=請選擇您的操作: if "%choice%"=="0" goto menu if "%choice%"=="cmdTPd echoo; "^[1-9aq]$">nul || echo.&&echo !input_error!&&goto rechoice echo;%choice%|findstr "^[1-4]$">nul && goto getname if "%choice gove "%choice%"=="6" goto resetpass if "%choice%"=="7" goto allowport if "%choice%"=="8" goto secset if "%choice%"=test="9" g spTP3T=test_9" g iperf3_test if "%choice%"=="q" exit :: ========================================================================================================================================================================================================================================================== / .clscls> 取得配置的網卡名稱 = 3" %%a in ('netsh interface show interface ^| findstr "已連接"') do ( set "ethname!i!=%%b" set /a i+=1 ) set /ai=1TP==3Ti%-1 set /a i+=1 ) set /ai=1TP==3Ti%-1 if defined eth1 ) if.目前已連線狀態的網路卡只有:!ethname1! set "ethname=!ethname1!" goto inputbegin ) echo 目前已連線狀態的網路卡有: for /l %%j in (1,1,!i!) do ( echo %T) 4537 月) TP沒有網路卡是已連線狀態,請檢查...按任意鍵返回主選單&& pause >nul 2>nul & goto menu set nic=init set /p nic=請選擇要設定的網卡名稱[1-!i!]: if "%nic%"=="0"|dvd esgchoTvdvSvsvSdform; "^[1-!i!]$">nul || (cls&&echo.&&echo !input_error! && goto getname) set "ethname=!ethname%nic%!" echo.&echo 您選擇的網路卡是"!ethname! "%choice%"=="2" goto inputipd if "%choice%"=="3" goto inputips if "%choice%"=="4" goto ipbydhcp :: ====================================================================================================================================================================================================================================================================================================================================================================================================================================================' ips/pin= %ips% == 0 goto menu for /f "tokens=1-5* delims=./ " %%a in ("!ips!") do ( set x1=%%a set x2=%%bTP3T%b set x3T x5=%%e ) for %%i in (!x1! !x2! !x3! !x4! !x5!) do ( set /a %%i 2>nul || (echo !input_error!x 255 if !x2! geq 0 if !x2! leq 255 ^ if !x3! geq 0 if !x3! leq 255 if !x4! geq 0 if !x4! leq 255 ^ iflex echo. echo !input_error! & goto inputips :inputok if !x5! == 29 ( set x6=248 set /an=!x4!/8 set /am=!n!*8 set /a x7=!m!+6 ) set /am=!n!*16 set /a x7=!m!+14 ) if !x5! == 27 ( set x6=224 set /an=!x4!/32 set /am=!n!*32 set /a x7=!m!+30 set /am=x5) /an=!x4!/64 set /am=!n!*64 set /a x7=!m!+62 ) if !x5! == 25 ( set x6=128 set /an=!x4!/128 set /am=!n!*128 set/an=!x4!/128 set /am=!n!*128 set /a x== 128 x== 250 250 250 250000 40000x 4x 250 40x 25)! set x6=0 set m=0 set x7=254 ) if !x4! leq !m! echo !input_error! && goto inputips if !x4! geq !x7! echo !input_error! && goto inputips set !x7! echo !input_error! && goto inputips set .x7! netmask=255.255.255.!x6! set gateway=!x1!.!x2!.!x3!.!x7! echo. echo 您要設定的IP資訊如下: echo Server IP: !addr! echo NetMask: !netmask! echo Gateway:!waygate echoo! set tip=init set /p tip=確認無誤後請按Enter鍵開始設定... if "%tip%"=="0" goto menu echo 正在設定主IP... netsh interface ip set address name="!ethname!" source=static addrway interem interface interface intertoq 303 月! set dns name="!ethname!" source=static addr=!dns1! >/nul netsh interface ip add dns "!ethname!" addr=!dns2! index=2 >/nul ping 127.1 -n 5 >nul echo 主配置完成 Schoe.com pingn;可以PING通百度! inputipd goto menu :: ============================================================================================================================================================================================================================================================================================================================================================================== :inputipm echo. echo. 108.186.1.1-10/27 echo. set ipm=init set /p ipm=輸入你要設定的連續IP: if "%ipm%" == "0" goto menu echo. for /f "tokens=1-6* de TP/i/ipdoi ( x1=%%a set x2=%%b set x3=%%c set x4=%%d set x5=%%e set x6=%%f for %%i inTe set x6=%%f for %%i inTexdo! ( echo;%%i|findstr "^[0-9]$">nul || echo;%%i|findstr "^[1-9][0-9]$">nul || ^ echo;%%ifindstrstr"^1][00001][000 echo;%%i|findstr "^[2][0-4][0-9]$">nul || ^ echo;%%i|findstr "^[2][5][0-5]$">nul || echo !input_error!& gchooin; "^[2][4-9]$">nul || echo !input_error! && goto inputipm if !x6! == 29 ( set x6=248 set /an=!x4!/8 set /am=!n!*8 set /a== 8m. set /an=!x4!/16 set /am=!n!*16 set /a x7=!m!+14 ) if !x6! == 27 ( set x6=224 set /an=!x4!/32 set /am=!n!*32 set /an=!m4!/32 set / x6=192 set /an=!x4!/64 set /am=!n!*64 set /a x7=!m!+62 ) if !x6! == 25 ( set x6=128 set /an=!x4!/128 set /am+!n! !x6! == 24 ( set x6=0 set m=0 set x7=254 ) if !x4! leq !m! (echo !input_error! & goto inputipm) if !x4! geq !x7! (echocho! !input_error! & goto inputipm) if !x5! geq !x7! (echo !input_error! & goto inputipm) ) :start_configure set start_ip=!x1!.!x2!.!x3!.!x4!set 1.px2! netmask=255.255.255.!x6! set gateway=!x1!.!x2!.!x3!.!x7! echo. echo 您要設定的IP資訊如下: echo 起始IP: !start_ip! echo 結束IP: !end_ip echo way 光罩式遮罩。 "!ethname!" !net!.%%i !netmask! >nul && (echo !net!.%%i 已新增至「!ethname!」上) netsh interface ip add address "!ethname!" gateway=!gateway > gwmtric 20000000 字詞source=static addr=!dns1! >/nul netsh interface ip add dns "!ethname!" addr=!dns2! index=2 >/nul echo. ping baidu.com >nul && (echo 可以PING通百度!!) ping baidu.com >nul && (echo 可以PING通百度!!) ||echo ING gING 10 月! ================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================ 完整段示例整段範例。 108.186.1.0/24 echo. set ipd=init set /p ipd=請輸入您要設定的IP區段: if "%ipd%" == "0" goto menu for /f "tokens=1-5* deblates=d – 1335" ( x1=%%a set x2=%%b set x3=%%c set x4=%%d set x6=%%e for %%i in (!x1! !x2! !13Te for %%i echoo) ! !x2!! "^[0-9]$">nul || echo;%%i|findstr "^[1-9][0-9]$">nul || ^ echo;%%i|findstr "^[1][0-9][0-9]%%i|findstr "^[1][0-9][0-9]$">nvul 1|| "^[2][0-4][0-9]$">nul || ^ echo;%%i|findstr "^[2][5][0-5]$">nul || echo !input_error! && goto inputipd ) echo">nul || echo !input_error! && goto inputipd ) echo">nul || echo !input_error! && goto inputipd ) echo; !input_error! && goto inputipd if !x6! == 29 ( set /an=!x4! %% 8 if !n! neq 0 echo !input_error! && goto inputipd set /a x4!x4! x7=x5+1 set x6=248) if !x6! == 28 ( set /an=!x4! %% 16 if !n! neq 0 echo !input_error! && goto inputipd set /a x4=x4x4x4x 5/1a x7=x5+1 set x6=240) if !x6! == 27 ( set /an=!x4! %% 32 if !n! neq 0 echo !input_error! && goto inputipd set /a x4=x4x4x 5/d x7=x5+1 set x6=224) if !x6! == 26 ( set /an=!x4! %% 64 if !n! neq 0 echo !input_error! && goto inputipd set /a x4=x4x4x4x/aset xa/aset 5/aset 6/4x x7=x5+1 set x6=192) if !x6! == 25 ( set /an=!x4! %% 128 if !n! neq 0 echo !input_error! && goto inputipd set /a x4= 14x4x setx4x4x4x4x4x4x 4x4x4 月 14024x4x4x 4x4x4 12024x4x 4x4x4 1/ x7=x5+1 set x6=128) if !x6! == 24 ( if !x4! neq 0 echo !input_error! && goto inputipd set /a x4=!x4!+1 set /a x5=!x4!+252 set /+ xure set config 53_!x4!+252 設置:: ================================================================ name="!ethname!" source=DHCP >nul 2>nul echo.&echo !ethname!已設定為DHCP取得IP,請按任何鍵返回主選單&& pause >nul 2>nul & goto menu ::==============================================================================================================================================================================================設定administrator密碼:resetpass cls echo. echo 設定管理員使用者administrator的密碼:inputpwd echo. set "var1=本腳本不支援^!^#^^^&^|^"^<^> 這些字符! " set "var2=如有以上字元會導致使用者密碼無效! " echo !var1! echo !var2! echo !var2! echo !var2! echo. set "chars=^^! ^^# ^^ ^^& ^^| ^^" ^< ^>" set pwd=0 set /p "pwd=請輸入要設定的密碼: " if %pwd% == 0 goto menu for %%i in (!chars!) do set pwd=!pwd:^%%i in (!chars!) do set pwd=!pwd:^%%i=! && (echo 密碼設定成功) || (echo 密碼不符合密碼原則的要求,請重新輸入... && goto inputpwd ) echo. echo 請按任意鍵返回主選單&& pause >nul 2>nul & goto menu :: ================================================================ :: 修改遠端桌面連接埠號碼:setremoveport cls echo. set n=1 for /f "tokens=1-3 delims= " %%i in ('tasklist /svc ^| findstr "TermService"') do ( set pid=%%indstr "TermService"') do ( set pid=%% set /a = 1n set / set-n-1-n set -1n-n set -1n-1-n set -1n-n set 5-1n-n set -1n-1-n set 5-n set 5-n ! == 1 ( for /f "tokens=1-3 delims=: " %%a in ('netstat -p tcp -ano ^| findstr "!pid!"') do (set "removeport=%%c") echo。遠端桌面服務沒有開啟,按任意鍵返回主選單&& pause >nul 2>nul && goto menu echo. echo 遠端桌面連接埠號範圍:1024-65535 不能與其他連接埠衝突:resetremoveport echo. set port=init set /p port=TPdomen portp. set /a %port% 2>nul || (echo !port_error! & goto resetremoveport) if !port! geq 1024 if !port! leq 65535 goto portok echo !port_error!port! leq 65535 goto portok echo !port_error! name="Allow %port%" >nul 2>nul netsh advfirewall firewall add rule name="Allow %port%" protocol=TCP dir=in localport=%port% action==mallow add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /t reg_dword /d %port% /f >nul reg add "HKLM\SYSTEM\CurrentControlSetv/Nrmg ng n; /d %port% /f >nul ping 127.1 -n 2 >nul echo 遠端埠號碼設定完成echo 正在重新啟動遠端桌面服務... net stop UmRdpService >nul 2>nul net stop TermService >nul 2>nul pingn 177. 2>nul ping 127.1 -n 2 >nul echo 遠端桌面服務重啟完畢echo. echo 請按任何鍵返回主選單&& pause >nul 2>nul & goto menu :: ==============================================================================防火牆允許指定連接埠號碼:allowport cls echo. set port=init set /p port=請輸入要允許的連接埠號碼: if %port% == 0 goto menu set /a %port% 2>nul || (echo !port !port! leq 65535 goto portok2 echo !port_error! & goto allowport :portok2 netsh advfirewall firewall delete rule name="Allow %port%" >nul 2>nul netsh advt dir=in localport=%port% action=allow >nul && (echo 防火牆允許%port%連接埠) echo. echo 請按任意鍵返回主選單&& pause >nul 2>nul & goto menu :: ================================================================================================================================================================================================================================================== = tip=允許PING,開啟遠端桌面,確認請按Enter鍵開始設定... if %tip% == 0 goto menu echo 正在配置防火牆、允許PING、開啟遠端:: 停用所有入站規則netsh advfirewall firewall set rule name=all dir=in new ablesh advfirewall firewall set rule name=all dir=in new ableno新增阻止TCP和UDP連接的連接埠(135\137\138\139\445) netsh advfirewall firewall delete rule name="DENY tcp 135" >nul 2>nul netsh advfirewall firewall add rule name="DENY 135" protocal=Badvfire name="DENY 135 >nul && (echo DENY tcp 135) netsh advfirewall firewall delete rule name="DENY udp 135" >nul 2>nul netsh advfirewall firewall add rule name="DENY udp 135" protocoldPwulkprodin 503000in (concUkl 5" proto 135) netsh advfirewall firewall delete rule name="DENY tcp 137" >nul 2>nul netsh advfirewall firewall add rule name="DENY tcp 137" protocol=TCP dir=in localport=137 actioncaln 137" protocol=TCP dir=in localport=137 action firewall delete rule name="DENY udp 137" >nul 2>nul netsh advfirewall firewall add rule name="DENY udp 137" protocol=UDP dir=in localport=137 action=block >nul &adv name="DENY tcp 138" >nul 2>nul netsh advfirewall firewall add rule name="DENY tcp 138" protocol=TCP dir=in localport=138 action=block >nul && (echo DENY tcpete 138) net cpete 8 >nul 2>nul netsh advfirewall firewall add rule name="DENY udp 138" protocol=UDP dir=in localport=138 action=block >nul && (echo DENY udp 138) netsh action=block> advfirewall firewall add rule name="DENY tcp 139" protocol=TCP dir=in localport=139 action=block >nul && (echo DENY tcp 139) netsh advfirewall firewall delete rule name="DEDE tcp 139) netsh advfirewall firewall delete rule name="DEDENY 139 name="DENY udp 139" protocol=UDP dir=in localport=139 action=block >nul && (echo DENY udp 139) netsh advfirewall firewall delete rule name="DENY tcpv445" >nul 2>n 485 protocol=TCP dir=in localport=445 action=block >nul && (echo DENY tcp 445) netsh advfirewall firewall delete rule name="DENY udp 445" >nul 2>nul netsh advfirewall namewall 445" >nul 2>nul netsh advfirewall nameto localport=445 action=block >nul && (echo DENY udp 445) :: 允許PING netsh advfirewall firewall set rule name="檔案與印表機共用(回顯請求- ICMPv4-In)" dir=in new enable=yyes >ulv name="檔案與印表機共用(回顯請求- ICMPv6-In)" dir=in new enable=yes >nul 2>nul :: 啟用遠端桌面reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDe/TSConnectionsORD RDem/EGD防火允許遠端連接netsh advfirewall firewall set rule name="遠端桌面(TCP-In)" dir=in new enable=yes >nul && (echo 防火牆允許遠端桌面) || ^ netsh advfirewall firewall set rule name="遠端桌面- 使用者模式(TCP-mable)"防火牆允許遠端桌面) netsh advfirewall firewall set rule name="遠端桌面- 使用者模式(UDP-In)" dir=in new enable=yes >nul 2>nul netsh advfirewall firewall set rule name="遠端桌面- 遠端監控(TCP-Incfulululk firewall set rule name="遠端桌面- RemoteFX (TCP-In)" dir=in new enable=yes >nul 2>nul :: 遠端桌面安全性驗證0 為允許任何連結1為僅允許安全的連線reg REG_DWORD /d "0" /f >nul 2>nul :: 關閉磁碟自檢reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager" /v BootExecute /t reg_multi_sz /d "" 重新啟動模式bootstatuspolicy ignoreallfailures >nul 2>nul bcdedit /set {current} recoveryenabled No >nul 2>nul :: 服務可進行的最大正時間校準量調整為總是校準時間reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSetWegaseCurrent2\sregase/CurrentvP. REG_DWORD /d "0xFFFFFFFF" /f >nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time\Config" /v MaxPosPhaseCorrection /t REG_DW32Time\Config" /v MaxPosPhaseCorrection /t REG_DWFFORD /d " 0FFn>與time.windows.com時間同步sc config w32time start= auto >nul 2>nul net stop w32time >nul 2>nul net start w32time >nul 2>nul net time \\127.0.0.1 /setntp:com /manualpeerlist:time.windows.com,0x8 /syncfromflags:MANUAL >nul 2>nul w32tm /resync >nul 2>nul :: 關閉IE ESC yes 為關閉no為開啟regreg add "HKserEY_CURRENT_USER\Mu mids mecome mrys 3000000/Microsoft 30/Fk /Microsoft "yes" /t REG_SZ /f >nul 2>nul reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Play_Animations" /d "yes" /t REG_SZ /f >nul 2Animations" /d "yes" /t REG_SZ /f >nul 2Animations" /d "yes" /t REG_SZ /f >nul 2Animations "Play_Background_Sounds" /d "yes" /t REG_SZ /f >nul 2>nul :: 開啟防火牆netsh advfirewall set allprofiles state on >nul 2>nul && (echo 防火牆netsh advfirewall set allprofiles state on >nul 2>nul && (echo 防火牆 >ul) echo. echoo 完成功能:speedtest_cli set speedtestfile=C:\Windows\System32\speedtest.exe if not exist !speedtestfile! ( powershell Invoke-WebRequest -Uri "http://198.200.51.51/speedtest。 ) else ( speedtest.exe --accept-license 2>null ) echo. echo 請按任意鍵返回主選單&& pause >nul 2>nul & goto menu :iperf3_test cls set "SV2_SERVER=142.4.97.233" set "126189. "LA2_SERVER=107.148.135.25" set iperf3file=C:\Windows\System32\iperf3.exe if not exist !iperf3file! ( echo.&&echo 正在下載iperf3... powershell Invoke-WebRequest -Urif.http://195120251520.155120205512005525202052520205 月. -OutFile "C:\Windows\System32\cygwin1.dll" powershell Invoke-WebRequest -Uri "http://198.200.51.51/iperf3/iperf3.exe" -OutFile "C:\Windows\System32\ipe3.exe" ) : 已經下載 echo.可選iperf3測速節點echo 1 SV2 echo 2 SV6 echo 3 LA2 set choice=init set /p choice=請選擇測速節點ID[1-3]: if "%choice%"=="0" goto menu if "%chodcm "%choice%"=="1" ( echo.&&echo 測試本機到SV2節點上傳頻寬... iperf3 -c !SV2_SERVER! echo.&&echo 測試本機到SV2節點下載頻寬... iperf3 -c !SV2_SERVER! -Ropan paicpad pa&ulr; "%choice%"=="2" ( echo.&&echo 測試本機到SV6節點上傳頻寬... iperf3 -c !SV6_SERVER! echo.&&echo 測試本機到SV6節點下載頻寬... iperf3 -c !SV6_SERVER! -Ropan panntpad panicpan; "%choice%"=="3" ( echo.&&echo 測試本機到LA2節點上傳頻寬... iperf3 -c !LA2_SERVER! echo.&&echo 測試本機到LA2節點下載頻寬... iperf3 -c !LA2_SERVER! -Rchoopan; !input_error! && goto choice_SERVER :: ####################### ####################### ####################### ####################### :en :: Title title WinTools Applicable to win7/2008+ system --By Shihua :: Global variable,DNS set dns1=8.8.8.8 set dns2=8.8.4.4 set "input_error=Input error,please retype..." 545,454:34,45,45,45,454), 543:549set」 please retype..." set ver=2.6 :: init goto menu_en :: ================================================================================================================================================================================================================================================================================================================================================================================================== ---------------------------------------------------------- echo 1 Configure continuous IP echo 2 Configure a subnet IP echo 3 Configure the man IP echo 4 Set get IP by DHCP echo 5 Show^&Set RDP port echo 6 Set administrator's pwdcho Set Set RDP port echo 6 Set administrator's pwdchooport Set pul 3, commot 表echo 9 Download and run speedtest_cli echo a Download and run iperf3_cli echo q Exit echo -------------------------------------------------------- echo Instructions: echo 1. Any waiting for input, input "0" return the menu echo 2. All IP configurations only appup 0" return the menu echo 2. All IP configurations only appup 0" return the monu echo 是:rechoice_en echo. set choice=init set /p choice=Pls input: if "%choice%"=="0" goto menu_en if "%choice%"=="cmd" cmd echocho; echo.&&echo !input_error!&&goto rechoice_en echo;%choice%|findstr "^[1-4]$">nul && goto getname_en if "%choice%"=="5" goto setremove_en if "%choice%"=="5" gotooto setremove_Lot; if "%choice%"=="7" goto allowport_en if "%choice%"=="8" goto secset_en if "%choice%"=="9" goto speedtest_cli_en if "%choice%"=="9" goto speedtest_cli_en if "%choice13T"=="9" goto speedtest_cli_en if "%choice13T""5""h "%choice%"=="q" exit :: ========================================================================================================================================================================================================================================================== /set/ ('netsh interface show interface ^| findstr "Connected"') do ( set "ethname!i!=%%b" set /a i+=1 ) set /ai=%i%-1 if defined ethname1 ( set !i! TP3Ti15T-1 if defined ethname1 ( NIC "ethname=!ethname1!" goto inputbegin_en ) echo The connected NIC as follows: for /l %%j in (1,1,!i!) do ( echo %%j. !ethname%%! 詞menu. && pause >nul 2>nul & goto menu_en set nic=init set /p nic=Pls select NIC [1-!i!]: if "%nic%"=="0" goto menu_en echo;%nic1313T"=="0" goto menu_en echo;%nic1345; (cls&&echo.&&echo !input_error! && goto getname_en) set "ethname=!ethname%nic%!" echo.&echo The IP will be configured on the "!ethname!" :inputbegin_en if "13Tchoured on the "!ethname!" :inputbegin_en if "13Tchoo5"pchoo=Tchoooodoo +pchoooo "%choice%"=="2" goto inputipd_en if "%choice%"=="3" goto inputips_en if "%choice%"=="4" goto ipbydhcp_en :: ======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== 27745:2745:00 4745:0 月 IP 是 27745: 7745:2745:0 月 IP 是if %ips% == 0 goto menu_en for /f "tokens=1-5* delims=./ " %%a in ("!ips!") do ( set x1=%%a set x2=TPTbTPT set x5=%%e ) for %%i in (!x1! !x2! !x3! !x4! !x5!) do ( set /a %%i 2>nul || (echo !input_error!TP leq 255 if !x2! geq 0 if !x2! leq 255 ^ if !x3! geq 0 if !x3! leq 255 if !x4! geq 0 if !x4! leq 255 ^if !x4! geq 0 if !x4! leq 255 inputok_en cls echo. echo !input_error! & goto inputips_en :inputok_en if !x5! == 29 ( set x6=248 set /an=!x4!/8 set /am=!n!*8 set /a== 8m. set /an=!x4!/16 set /am=!n!*16 set /a x7=!m!+14 ) if !x5! == 27 ( set x6=224 set /an=!x4!/32 set /am=!n!*32 set /an= setm/32 x== 5/am= x6=192 set /an=!x4!/64 set /am=!n!*64 set /a x7=!m!+62 ) if !x5! == 25 ( set x6=128 set /an=!x4!/128 set /am+!n! !x5! == 24 ( set x6=0 set m=0 set x7=254 ) if !x4! leq !m! echo !input_error! && goto inputips_en if !x4! geq !x7! echocho !in gputipor! addr=!x1!.!x2!.!x3!.!x4! set netmask=255.255.255.!x6! set gateway=!x1!.!x2!.!x3!.!x7! echo. echo The IP details as follows: echo. Gateway: !gateway! echo DNS1: !dns1! echo DNS2: !dns2! echo. set tip=init set /p tip=Please confirm then press Enter... if "%tip%"=="0" goto menmenu_en echoomen interface set word word app name="!ethname!" source=static addr=!addr! mask=!netmask! gateway=!gateway! 1 netsh interface ip set dns name="!ethname!" source=static addr=!dns1! >/nul netsh interface ip ; 127.1 -n 5 >nul echo Configuration done echo. ping www.baidu.com ::echo. ::ping www.baidu.com >nul && (echo The network is.) || (echo The network is bad) :configmore_en echo ext.) || (echo set p. 2.Configure a subnet IP; Else return menu: if "%next%"=="0" goto menu_en if !next! == 1 goto inputipm_en if !next! == 2 goto inputipd_en goto menu_en if ============================================================================================ :: Configure continuous IP :inputipm_en echo. echo Example: 108.186.1.1/27-108.186.1.10/27 echo Pls input: 108.186.1.1-10/27 echo. set ipm=init set /p ipm=Pls input continuous IP: if "%ipm%" == "0" goto menu_en echo. for /f "tokens=1-6 set x1=%%a set x2=%%b set x3=%%c set x4=%%d set x5=%%e set x6=%%f set x5=%%e set x6=%%f for %TP3Tix inx 2x5! do ( echo;%%i|findstr "^[0-9]$">nul || echo;%%i|findstr "^[1-9][0-9]$">nul || ^ echo;%%inTin| echo;%%i|findstr "^[2][0-4][0-9]$">nul || ^ echo;%%i|findstr "^[2][5][0-5]$">nul || echo !input_error!& gcotod injkd: finddone ejid; "^[2][4-9]$">nul || echo !input_error! && goto inputipm_en if !x6! == 29 ( set x6=248 set /an=!x4!/8 set /am=!n!*8 set /a x 7=x 699= 48 )! x6=240 set /an=!x4!/16 set /am=!n!*16 set /a x7=!m!+14 ) if !x6! == 27 ( set x6=224 set /an=!x4!/32 == 27 ( set x6=224 set /an=!x4!/32 set /am !n! 26 ( set x6=192 set /an=!x4!/64 set /am=!n!*64 set /a x7=!m!+62 ) if !x6!== 25 ( set x6=128 set /an=!x4!/128 set /am= 128 set /an=!x4! if !x6! == 24 ( set x6=0 set m=0 set x7=254 ) if !x4! leq !m! (echo !input_error! & goto inputipm_en) if !x4! geq !x7! (echo !inalx7 !x4! (echo !input_error! & goto inputipm_en) if !x5! geq !x7! (echo !input_error! & goto inputipm_en) ) :start_configure_en set start_ip=!x1!.ipm_en) ) :start_configure_en set start_ip=!x1!.!x2!.!x33! end_ip=!x1!.!x2!.!x3!.!x5! set netmask=255.255.255.!x6! set gateway=!x1!.!x2!.!x3!.!x7! echo. echo The continuous IP details as …x3!.!x7 !end_ip! echo Gateway : !gateway! echo Netmask : !netmask! set net=!x1!.!x2!.!x3! echo. set tip=init set /p tip=Please confirm then press Enter. %%i in (!x4!,1,!x5!) do netsh interface ip add address "!ethname!" !net!.%%i !netmask! >nul && (echo !net!.%%i !netmask! >nul && (echo !net!.%%i added "!ethname! gateway=!gateway! gwmetric=2 >/nul netsh interface ip set dns name="!ethname!" source=static addr=!dns1! >/nul netsh interface ip add dns "!ethname!" addr=!dns2! netsh interface ip add dns "!ethname!" addr=!dns2! ok.) || (echo The network is bad.) goto configmore_en :: ====================================================================================================================================================================================== /24,/25,/26,/27,/28,/29. echo Example: 108.186.1.0/24 echo. set ipd=init set /p ipd=Pls input a subnet IP: if "%ipd1TP3" d=Pls input a subnet IP: if "%ipd135" delims=./ " %%a in ("!ipd!") do ( set x1=%%a set x2=%%b set x3=%%c set x4=%%d set x3=%%c set x4=%%d set x3=%%c set x4=%%d set x6313T%x 131315 月 1311315121325113113600006166666616626-Tx !x3! !x4!) do ( echo;%%i|findstr "^[0-9]$">nul || echo;%%i|findstr "^[1-9][0-9]$">nul || ^ echo;%1TP33; "^[1][0-9][0-9]$">nul || echo;%%i|findstr "^[2][0-4][0-9]$">nul || ^ echo;%%i|findstr "^[2][5][0-5]h; inputipd_en ) echo;!x6!|findstr "^[2][4-9]$">nul || echo !input_error! && goto inputipd_en if !x6! == 29 ( set /an=!x4! %1 3T 1850!n beii _sh; inputipd_en set /a x4=!x4!+1 set /a x5=!x4!+4 set /a x7=x5+1 set x6=248) if !x6! == 28 ( set /an=!x4! %% 16 if. inputipd_en set /a x4=!x4!+1 set /a x5=!x4!+12 set /a x7=x5+1 set x6=240) if !x6! == 27 ( set /an=!x4! %% 32 q.dned ben derrone bejin 3T1TP inputipd_en set /a x4=!x4!+1 set /a x5=!x4!+28 set /a x7=x5+1 set x6=224) if !x6! == 26 ( set /an=!x4! %% 64 nq. inputipd_en set /a x4=!x4!+1 set /a x5=!x4!+60 set /a x7=x5+1 set x6=192) if !x6! == 25 ( set /an=!x4! %% 1285 !n &choo &choo &oin &oin &oin &oin &oin &oin &oin &oin &oin &oin &oin &oin &perwin &perw; inputipd_en set /a x4=!x4!+1 set /a x5=!x4!+124 set /a x7=x5+1 set x6=128) if !x6! == 24 ( if !x4! neq 0 echo !input_errorx &xd in verror xd set xd 0 echo /a x5=!x4!+252 set /a x7=x5+1 set x6=0) ) goto start_configure_en :: ================================================================================================================================================================================ ================================================= ======================= interface ip set address name="!ethname!" source=DHCP >nul 2>nul netsh interface ip set dns name="!ethname!" source=DHCP >nul 2>nul echo.&echo !ethname! Set to get IP for DHCPs, press any :: ======================================================================================================================================================================================================================================================================================================== reset administrators passcl. ^!^#^^^&^|^"^<^> characters!" set "var2=If the above characters will cause the user password invalid." echo !var1! echo !var2! echo !var2! echo !var2! echo. set "chars=^^! ^^# ^^ ^^< ^>" set pwd=0 set /p "pwd=Pls input new password: " if %pwd% == 0 goto menu_en for %%i in (!chars!) do set pwd=!pwd:^%%ix 2>nul && (echo Password set done) || (echo Password does not meet the requirements, please re-enter... && goto inputpwd_en ) echo. echo press any key return menu && pause >nul 2>nul & goto menu_en ============================================================================================ :: Show&Set RDP port :setremoveport_en cls echo. set n=1 for /f "tokens=1-3 delims= " %%i in ('tasklist /svc ^| findstr "TermService"') do ( set pid=%%j set /a n+=1 ) set /an=!n!-1 if !n! == 1 ( for /f "tokens=1-3 delims=: " %%a in ('netstat -pidid. "removeport=%%c") echo. echo Now the RDP port is: !removeport! ) else echo RDP service is not enable,press any key return menu && pause >nul 2>nul && goto menu_DP echoopa. conflict with other ports :resetremoveport_en echo. set port=init set /p port=Pls input new port: if %port% == 0 goto menu_en echo. set /a %port13T 2oto menu_en echo. set /a %port1. if !port! geq 1024 if !port! leq 65535 goto portok_en echo !port_error! & goto resetremoveport_en :portok_en netsh advfirewall firewall delete rule name="Allow %port135 name="Allow %port%" protocol=TCP dir=in localport=%port% action=allow >nul && (echo firewall allow %port% port) echo Configuring R; Server/Wds/rdpwd/Tds/tcp" /v PortNumber /t reg_dword /d %port% /f >nul reg add "HKLM/SYSTEM/CurrentControlSet/Control/Terminal Server/WinStations/RDP-Tcp" /vregNTP Set/Control/Terminal 127.1 -n 2 >nul echo Configuration done echo Restart RDP service... net stop UmRdpService >nul 2>nul net stop TermService >nul 2>nul ping 127.1 -n 5 >nul 2>nulService done echo. echo Press any key return menu && pause >nul 2>nul & goto menu_en :: ============================================================================================ :: firewall allows you to specify a port number :allowport_en cls echo. set port=init set /p port=Pls input port number: if %port% == 0 goto menu_en set /a %port% 2>nul || (echo !port_error! & goto allowport_en) echoo. 65535 goto portok2_en echo !port_error! & goto allowport_en :portok2_en netsh advfirewall firewall delete rule name="Allow %port%" >nul 2>nul netsh name="Allow %port%" >nul 2>nul netsh advt dir=in localport=%port% action=allow >nul && (echo firewall allow %port% port) echo. echo Press any key return menu && pause >nul 2>nul & goto menu_en :: ============================================================================================= :: Configure firewalls and enable RDP :secset_en cls echo. set tip=init echo Set firewallit echo port=135,137,138,139,445/TCP^&UDP set /p tip=Allow PING,enable RDP,Please confirm then press Enter... if %tip% == 0 goto menu_en echoirable able/clates 38 號netsh advfirewall firewall set rule name=all dir=in new enable=no >nul 2>nul :: Deny TCP&UDP ports(135/137/138/139/445) netsh advfirewall firewall delete rule name="DEDEn add rule name="DENY tcp 135" protocol=TCP dir=in localport=135 action=block >nul && (echo DENY tcp 135) netsh advfirewall firewall delete rule name="DENY udp 135" >n 2dn 135" protocol=UDP dir=in localport=135 action=block >nul && (echo DENY udp 135) netsh advfirewall firewall delete rule name="DENY tcp 137" >nul 2>nul netsh advTC dir=in localport=137 action=block >nul && (echo DENY tcp 137) netsh advfirewall firewall delete rule name="DENY udp 137" >nul 2>nul netsh advfirewall firewall addp 137" >nul 2>nul netsh advfirewall firewall addpule name="DEnul 2>nul netsh advfirewall firewall 地址action=block >nul && (echo DENY udp 137) netsh advfirewall firewall delete rule name="DENY tcp 138" >nul 2>nul netsh advfirewall firewall add rule name="DENY tcp 138" protocolm>Pwvrow 38" protogft DENY tcp 138) netsh advfirewall firewall delete rule name="DENY udp 138" >nul 2>nul netsh advfirewall firewall add rule name="DENY udp 138" protocol=UDP dir=in loactionport 38nd advfirewall firewall delete rule name="DENY tcp 139" >nul 2>nul netsh advfirewall firewall add rule name="DENY tcp 139" protocol=TCP dir=in localport=139 action=block >nul name="DENY udp 139" >nul 2>nul netsh advfirewall firewall add rule name="DENY udp 139" protocol=UDP dir=in localport=139 action=block >nul && (echo DENY udp 139) DEete >nul 2>nul netsh advfirewall firewall add rule name="DENY tcp 445" protocol=TCP dir=in localport=445 action=block >nul && (echo DENY tcp 445) netsh advfirewall 45 advfirewall firewall add rule name="DENY udp 445" protocol=UDP dir=in localport=445 action=block >nul && (echo DENY udp 445) :: allow PING netsh advfirewall enable=yes >nul && (echo Allow PING) netsh adv火。 service/TCP) || ^ netsh advfirewall firewall set rule name="Remote Desktop - User Mode (TCP-In)" dir=in new enable=yes >nul && (echo firewall allowed RDP service/TCP) net enable=yes >nul && (echo firewall allowed RDP service/UDP) || ^ netsh advfirewall firewall set rule name="Remote Desktop - User Mode (UDP-In)" dir=in new enable=yes >nul & (netcov wall allowPfire page /t. name="Remote Desktop (TCP-In)" dir=in new enable=yes >nul 2>nul netsh advfirewall firewall set rule name="Remote Desktop - RemoteFX (TCP-In)" dir=in new enable=yote Desktop - RemoteFX (TCP-In)" dir=in new enable=yote Desktop - RemoteFX (TCP-In)" dir=in new enable=yote Desktop -nvvvul art User Mode (UDP-In)" dir=in new enable=yes >nul 2>nul :: Remote desktop security verification 0 to allow any link 1 to allow only secure connections reg add "HKEY_JCAL_MACHil "UserAuthentication" /t REG_DWORD /d "0" /f >nul 2>nul :: no autochk_disk reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager" /v Bootecute /Ft reg 2/p. bcdedit /set {default} bootstatuspolicy ignoreallfailures >nul 2>nul bcdedit /set {current} recoveryenabled No >nul 2>nul :: rsync time reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentSetN 你/Scor. REG_DWORD /d "0xFFFFFFFF" /f >nul 2>nul reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\W32Time\Config" /v MaxPosPhaseCorrection /t REG_DW32Time\Config" /v MaxPosPhaseCorrection /t REG_DW7ORD auto >nul 2>nul net stop w32time >nul 2>nul net start w32time >nul 2>nul net time \\127.0.0.1 /setsntp:time.windows.com >nul 2>nul w32 /config /man.time.windows.com >nul 2>nul w32 /config /manynpeerscom 9. >nul 2>nul w32tm /resync >nul 2>nul :: close IE ESC, yes for off, no for on reg add "HKEY_CURRENT_USER/Software/Microsoft/Internet Explorer/Main" /v "Enable BrowRRENT_USER/Software/Microsoft/Internet Explorer/Main" / "HKEY_CURRENT_USER/Software/Microsoft/Internet Explorer/Main" /v "Play_Animations" /d "yes" /t REG_SZ /f >nul 2>nul reg add "HKEY_CURRENT_USER/Software/Microsoft/Internet Explorer/Main" /Lounds" /f >nul 2>nul :: Enable Firewall netsh advfirewall set allprofiles state on >nul 2>nul && (echo Firewall enabled) echo. echo Set done, Press any key return menu && pause >nul 2>nn testnul 2>n testn testn; speedtestfile=C:\Windows\System32\speedtest.exe if not exist !speedtestfile! ( powershell Invoke-WebRequest -Uri "http://198.200.51.51/speedtest.exe" -OutFile "C:\Windows\System32. speedtest.exe --accept-license 2>null ) echo. echo Press any key return menu && pause >nul 2>nul & goto menu_en :iperf3_en set "SV2_SERVER=142.4.97.233" set "SV6_SER "LA2_SERVER=107.148.135.25" set iperf3file=C:\Windows\System32\iperf3.exe if not exist !iperf3file! ( echo.&&echo Downloading iperf3... powershell Invoke-WebRequest -U.0http://19520.215120.2151200215120025132005252320. -OutFile "C:\Windows\System32\cygwin1.dll" powershell Invoke-WebRequest -Uri "http://198.200.51.51/iperf3/iperf3.exe" -OutFile "C:\Windows\System32\ipe 3.exe" ) else Down echoo; iperf3 Server List echo 1 SV2 echo 2 SV6 echo 3 LA2 set choice=init set /p choice=Pls server id[1-3]: if "%choice%"=="0" goto menu_en if "%choice%"=="0" goto menu_en if "%choice%=="1cm "%choice%"=="1" ( echo.&&echo Test Upload to SV2... iperf3 -c !SV2_SERVER! echo.&&echo Test Download from SV2... iperf3 -c !SV2_SERVER! -R echo Press any key return menrf3 -c. "%choice%"=="2" ( echo.&&echo Test Upload to SV6...... iperf3 -c !SV6_SERVER! echo.&&echo Test Download from SV6... iperf3 -c !SV6_SERVER! -R echo Press any key return menrf3 -c !SV6_SERVER! -R echo Press any key return menrf&n pan&r. "%choice%"=="3" ( echo.&&echo Test Upload to LA2...... iperf3 -c !LA2_SERVER! echo.&&echo Test Download from LA2... iperf3 -c !LA2_SERVER! -R echo Press any key return menu& panbul; !input_error! && goto choice_SERVER_en

 

5/5 - (1 vote)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *