rustdesk / rustdesk/doc.rustdesk.com

PowerShell Script - Client Installation

Open
#309 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
792
Forks
709
Avg merge
8h 25m
Merged PRs (30d)
3

Description

Hi,
I had two issues with the script:

  1. the variable rustdesk_cfg was not defined correctly
  2. the install argument did not install the service
  3. the variable $rustdesk_id was not filled

`$ErrorActionPreference= 'silentlycontinue'

Assign the value random password to the password variable

$rustdesk_pw=(-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}))

Get your config string from your Web portal and Fill Below

$rustdesk_cfg = "=0nI9EUOpd0UzEHWY5UbSFWaSBXWnl2R1FWTQFFOSF3YyFkU3pmd5g3KLF3QQRlI6ISeltmIsIiI6ISawFmIsIiI6ISehxWZyJCLiQ3clRnLl5Wd05Waus2clRGdzVnciojI0N3boJye"

################################### Please Do Not Edit Below This Line #########################################

Run as administrator and stays in the current directory

if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
Start-Process PowerShell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command "cd '$pwd'; & '$PSCommandPath';"";
Exit;
}
}

$rdver = ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk").Version)

if($rdver -eq "1.2.2")
{
Write-Output "RustDesk $rdver is the newest version"
Exit
}

If (!(Test-Path C:\Temp))
{
New-Item -ItemType Directory -Force -Path C:\Temp > null
}

cd C:\Temp

Write-Host "Download rustdesk"
Invoke-WebRequest "https://github.com/rustdesk/rustdesk/releases/download/1.2.2/rustdesk-1.2.2-x86_64.exe" -Outfile "rustdesk.exe"
Write-Host "Install rustdesk"
Start-Process .\rustdesk.exe --silent-install -wait -Verbose

$ServiceName = 'Rustdesk'
$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue

if ($arrService -eq $null)
{
Write-Host "Wait 20 seconds"
Start-Sleep -seconds 20
}

$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue

if ($arrService -eq $null)
{
Write-Host "Install service"
cd $env:ProgramFiles\RustDesk
Start-Process .\rustdesk.exe --install-service -wait -Verbose
Start-Sleep -seconds 20
}

$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue

while ($arrService.Status -ne 'Running')
{
Start-Service $ServiceName
Start-Sleep -seconds 5
$arrService.Refresh()
}

cd $env:ProgramFiles\RustDesk
(.\RustDesk.exe --get-id | Write-Output -OutVariable rustdesk_id)

.\RustDesk.exe --config $rustdesk_cfg

.\RustDesk.exe --password $rustdesk_pw

Write-Output "..............................................."

Show the value of the ID Variable

Write-Output "RustDesk ID: $rustdesk_id"

Show the value of the Password Variable

Write-Output "Password: $rustdesk_pw"
Write-Output "..............................................."`

Sorry for the formation

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PowerShell script included in the issue and reproduce its installation flow on Windows. Check the configuration and ID variable assignments, service installation, and command output; the work is done when the script installs the service and reports the configured RustDesk ID and password as intended.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
devops, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.