Skip to content

Instantly share code, notes, and snippets.

@kripul
Last active December 20, 2022 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kripul/3663ffa6528c93075a1e49d637bb39cb to your computer and use it in GitHub Desktop.
Save kripul/3663ffa6528c93075a1e49d637bb39cb to your computer and use it in GitHub Desktop.
Custom RDP Port.
  • Jalankan script ini di RDP
  • Restart RDP
  • Login ke RDP dengan IP:5050
@ECHO OFF
cd.>%windir%\GetAdmin
if exist %windir%\GetAdmin (del /f /q "%windir%\GetAdmin") else (
echo CreateObject^("Shell.Application"^).ShellExecute "%~s0", "%*", "", "runas", 1 >> "%temp%\Admin.vbs"
"%temp%\Admin.vbs"
del /f /q "%temp%\Admin.vbs"
exit /b 2)
set 5050
set RULE_NAME="Open Port %PORT%"
netsh advfirewall firewall show rule name=%RULE_NAME% >nul
if not ERRORLEVEL 1 (
rem Rule %RULE_NAME% already exists.
echo Hey, you already got a out rule by that name, you cannot put another one in!
) else (
echo Rule %RULE_NAME% does not exist. Creating...
netsh advfirewall firewall add rule name=%RULE_NAME% dir=in action=allow protocol=TCP localport=%PORT%
)
reg add "HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d 5050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment