-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-rustdesk.bat
More file actions
79 lines (68 loc) · 2.56 KB
/
install-rustdesk.bat
File metadata and controls
79 lines (68 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
@echo off
setlocal enabledelayedexpansion
:: --- Configuration with Argument Support ---
set "relay_host=%~1"
if "!relay_host!"=="" set "relay_host=relay.unga.tech"
set "relay_key=%~2"
if "!relay_key!"=="" set "relay_key=bjAtiOq+3krNi+mQCcbS0FNQvoOGqaSStUKkOCk911M="
:: Check for Admin rights
net session >nul 2>&1
if %errorLevel% neq 0 (
echo Requesting Administrator privileges...
powershell -Command "Start-Process '%0' -Verb RunAs"
exit /b
)
echo ------------------------------------------
echo Ungatech Windows Deployment for RustDesk
echo Relay: !relay_host!
echo ------------------------------------------
:: --- WinGet Health Check ---
where winget >nul 2>&1
if %errorLevel% neq 0 (
echo [!] WinGet not found. Attempting to bootstrap Windows Package Manager...
powershell -Command "Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe"
timeout /t 5 >nul
)
:: Re-check after repair
where winget >nul 2>&1
if %errorLevel% neq 0 (
echo [!] WinGet is still missing. Please ensure 'App Installer' is updated in the MS Store.
pause
exit /b
)
echo Installing/Updating RustDesk...
winget install --id RustDesk.RustDesk --silent --force --accept-source-agreements --accept-package-agreements
set "RD_EXE=%ProgramFiles%\RustDesk\rustdesk.exe"
if not exist "!RD_EXE!" (
echo [!] Error: RustDesk executable not found at !RD_EXE!
pause
exit /b
)
echo Applying Server Configuration...
"!RD_EXE!" --config "host=!relay_host!,key=!relay_key!"
:passloop
set "pass1=" & set "pass2="
echo.
echo Set the Permanent Password (Input is MASKED):
for /f "usebackq delims=" %%i in (`powershell -Command "$p = read-host 'Enter Password' -AsSecureString; [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($p))"`) do set "pass1=%%i"
for /f "usebackq delims=" %%i in (`powershell -Command "$p = read-host 'Confirm Password' -AsSecureString; [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($p))"`) do set "pass2=%%i"
if "!pass1!"=="!pass2!" (
if not "!pass1!"=="" (
echo.
echo Passwords match. Applying...
"!RD_EXE!" --password "!pass1!"
set "pass1=" & set "pass2="
goto :success
)
)
set "pass1=" & set "pass2="
echo.
echo Error: Passwords do not match or are empty. Try again.
goto :passloop
:success
echo ------------------------------------------
echo Installation Complete!
echo Your Ungatech Support ID is:
"!RD_EXE!" --get-id
echo ------------------------------------------
pause