Last active
February 21, 2024 15:04
-
-
Save noelhibbard/1cbbf22734f9736663545f4171e897df to your computer and use it in GitHub Desktop.
RustDesk Install Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You can download/execute the script by running this from an elevetad PowerShell: | |
# irm https://gist.githubusercontent.com/noelhibbard/1cbbf22734f9736663545f4171e897df/raw/f52b4569df4c72dc04760a75842134d5e5fa1727/Install-RustDesk.ps1 | iex | |
$ErrorActionPreference = 'silentlycontinue' | |
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 | |
$rustdesk_cfg = Read-Host -Prompt "Config string" -AsSecureString | |
$rustdesk_pw = Read-Host -Prompt "Password (leave blank to generate a password)" -AsSecureString | |
$rustdesk_pw = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($rustdesk_pw)) | |
$rustdesk_cfg = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($rustdesk_cfg)) | |
if($rustdesk_pw -eq "") { | |
$autopassword = $True | |
$rustdesk_pw = (-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_})) | |
} | |
$nightlyDownloadUrl = (((Invoke-RestMethod -UseBasicParsing -Uri https://api.github.com/repos/rustdesk/rustdesk/releases) | ? tag_name -eq "nightly").assets | ? name -like 'rustdesk-*-x86_64.exe').browser_download_url | |
$productionDownloadUrl = (((Invoke-RestMethod -UseBasicParsing -Uri https://api.github.com/repos/rustdesk/rustdesk/releases) | ? teg_name -ne "nightly")[0].assets | ? name -like 'rustdesk-*-x86_64.exe').browser_download_url | |
if (!(Test-Path C:\Temp)) { | |
New-Item -ItemType Directory -Force -Path C:\Temp > null | |
} | |
Set-Location C:\Temp | |
Invoke-WebRequest $nightlyDownloadUrl -Outfile "rustdesk.exe" | |
"Installing Rustdesk" | |
.\rustdesk.exe --silent-install | |
$ServiceName = 'Rustdesk' | |
while ((Get-Service -Name $ServiceName -ErrorAction SilentlyContinue).Status -ne 'Running') { | |
"Waiting for service" | |
Start-Service $ServiceName | |
Start-Sleep -seconds 5 | |
} | |
Set-Location $env:ProgramFiles\RustDesk\ | |
.\rustdesk.exe --get-id | Write-Output -OutVariable rustdesk_id | Out-Null | |
.\rustdesk.exe --config $rustdesk_cfg | |
.\rustdesk.exe --password $rustdesk_pw | |
Write-Output "RustDesk ID: $rustdesk_id" | |
if($autopassword) { | |
Write-Output "Password: $rustdesk_pw" | |
} | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
i made a script for portable versions of Rustdesk.
In the hope of having done something pleasant.
script that I made, along the lines of the scripts below, downloads the latest version of Rustdesk (Nightly or Latest) using the GitHub API web service, configures the application by setting the IP and keys of your self-hosted server. Finally, it runs the application you just downloaded. That's all. ;-)
p.s.
PowerShell programming is absolutely not my comfort zone.. 👍
rustdesk/doc.rustdesk.com#309
PS Script Originally..:
rustdesk/rustdesk#7132
BR,
MT