Install RustDesk via Action1

By | December 3, 2025

I use Action1 to manage endpoints across many locations. The one thing Action1 is not excellent at and does not plan to be is a great remote access tool. Self-hosting RustDesk fits in perfectly for this need. I created a powershell script that can be run via Action1 to quickly install the RustDesk client onto all my endpoints silently along with adding a custom value to Action1 to let me know the RustDesk ID of each endpoint. This post is not about how to create your own self-hosted version of RustDesk, merely, show an example of how to deploy it via Action1 (Or similar tool) easily via a powershell automation.

The script below is sequential is very easy to follow. Modify it as you need.

Action1 Portal showing RustDesk ID fed via install script.

<#
.NOTES
    Author: C. Weis
    Versions:
    251203 Initial

.SYNOPSIS
    Install RustDesk client.

.DESCRIPTION
    Install RustDesk client with custom self hosted settings.
    Example created to show deployment via Action1.

.EXAMPLE
    [PS] C:\>.\RustDesk-Installer.ps1

#>


<# --------------------------------------------------------------------------------
	RustDesk configuration file.

    This is the contents of a file that will be created to replace configuration
    file that RustDesk installer creates. This file will contain info for self
    hosted server and key file.
----------------------------------------------------------------------------------- #>
$rd_config = @"
rendezvous_server = 'rs-ny.rustdesk.com:21116'
nat_type = 1
serial = 0
unlock_pin = ''
trusted_devices = ''

[options]
custom-rendezvous-server = 'PATH OR IP OF YOUR SELF HOSTED SERVER HERE'
direct-server = 'Y'
av1-test = 'N'
allow-remote-config-modification = 'Y'
key = 'YOUR CUSTOM KEY FILE CODE HERE'
relay-server = 'PATH OR IP OF YOUR SELF HOSTED SERVER HERE'
"@


<# --------------------------------------------------------------------------------
	Download Rustdesk MSI and drop into Temp directory.
----------------------------------------------------------------------------------- #>
$rd_src = 'https://github.com/rustdesk/rustdesk/releases/download/1.4.4/rustdesk-1.4.4-x86_64.msi'
$rd_dst = "$env:TEMP\rustdesk-1.4.4-x86_64.msi"

Invoke-RestMethod -Uri $rd_src -OutFile $rd_dst


<# --------------------------------------------------------------------------------
	Start Installation.
----------------------------------------------------------------------------------- #>
Write-Host "Calling Installer: $rd_dst" 
Start-Process 'msiexec' -ArgumentList "/i ""$rd_dst"" /qn INSTALLFOLDER=""C:\Program Files\RustDesk"" CREATESTARTMENUSHORTCUTS=""Y"" CREATEDESKTOPSHORTCUTS=""N"" INSTALLPRINTER=""N"" /l*v RDinstall.log" -Wait

# This delay is needed for lower end devices to finish installation process successfully.
Write-Host "Install completed. Pausing 30 Seconds." 
Start-Sleep -Seconds 30


<# --------------------------------------------------------------------------------
	Stop service and drop in new config file.
    This assumes script being run as localsys.
----------------------------------------------------------------------------------- #>
Stop-Service -Name RustDesk

$rd_configpath = 'C:\WINDOWS\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config'
$rd_config | Out-File -FilePath "$rd_configpath\RustDesk2.toml" -Encoding UTF8 -Force

Start-Service -Name RustDesk


<# --------------------------------------------------------------------------------
	Set Password

    Password is created based partially on machine name.
    Grab second through the fith characters of computername to create first 
    part of password. Then add additional string: ##Soda.
----------------------------------------------------------------------------------- #>
$rd_app = "C:\Program Files\RustDesk\RustDesk.exe"

$rd_pass = $Env:computername
$rd_pass = $rd_pass.Substring(1, 4) + "##Soda"

Start-Process $rd_app -ArgumentList "--password $rd_pass"

Write-Host "Password Set: $rd_pass"


<# --------------------------------------------------------------------------------
	Retrieve key ID number.

    Send to Text file in program directory and push to Action1 custom attribute.
----------------------------------------------------------------------------------- #>
$rd_id = & $rd_app --get-id | Out-String
$rd_id = $rd_id.Trim()

$rd_id | Out-File -FilePath "C:\Program Files\RustDesk\RustDesk-ID.txt" -Encoding UTF8 -Force

# Have Action1 set the RustDesk ID to a custom attribute named, "RustDesk ID".
Action1-Set-CustomAttribute 'RustDesk ID' $rd_id