Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save michele-tn/3dd7b8c2f4c6a4e3c21fd4b5c7d40a6d to your computer and use it in GitHub Desktop.

Select an option

Save michele-tn/3dd7b8c2f4c6a4e3c21fd4b5c7d40a6d to your computer and use it in GitHub Desktop.

RustDesk Portable Auto Downloader & Configurator (Windows x64)

This repository provides a PowerShell script that automatically downloads, configures, and launches the RustDesk Windows x64 portable client, using only your self-hosted ID server and public key.

It is ideal for:

  • πŸ”§ Mass deployment (RMM, GPO, Intune, etc.)
  • 🧰 Technicians who need a ready-to-use portable RustDesk client
  • πŸ’Ό Environments where software installation is restricted

Note
This script configures the client only.
It does not install or manage a RustDesk server.
For server setup, refer to the official RustDesk documentation.


Script Link

Official PowerShell script (published as a Gist):

πŸ”— RustDeskPortable.ps1:
https://gist.github.com/michele-tn/8a824d6257147718fd8384da0fa13f7a

You can:

  • download it as a single .ps1 file,
  • include it in deployment packages,
  • or run it remotely using PowerShell (Invoke-WebRequest, Invoke-RestMethod, etc.)

Features

  • πŸ†• Automatically fetches the latest RustDesk release tag from GitHub.
  • πŸ’Ύ Downloads the corresponding Windows x64 portable executable.
  • βš™οΈ Creates a valid RustDesk configuration file with:
    • rendezvous_server
    • key
  • 🧱 Uses the official RustDesk config path for the current user:
    %AppData%\RustDesk\config\RustDesk2.toml
    
  • πŸͺΆ No installation required β€” fully portable.
  • 🧾 Logs download and update information.
  • ▢️ Launches RustDesk automatically once configured.

Requirements

  • Operating System:
    Windows 10 / 11 (64-bit)

  • PowerShell:

    • Windows PowerShell 5.1+ or
    • PowerShell 7+
  • Network:
    Outbound HTTPS access to:

    • api.github.com
    • github.com
  • Server:
    Self-hosted RustDesk hbbs (ID server) and a valid public key (id_ed25519.pub).


Script Parameters

param(
    [string]$ServerIP = "192.168.1.100",   # ID server (hbbs)
    [string]$Key      = "MY_PUBLIC_KEY"    # Full contents of id_ed25519.pub
)
  • ServerIP β†’ Address or hostname of your RustDesk ID server (hbbs)
  • Key β†’ The full public key string used by your RustDesk server

Generated Configuration Example

The script writes this configuration file to:

%AppData%\RustDesk\config\RustDesk2.toml

Example contents:

rendezvous_server = 'rustdesk.yourdomain.com'
nat_type = 1
serial = 0

[options]
custom-rendezvous-server = 'rustdesk.yourdomain.com'
key = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMyExampleKey1234567890...'

Only ID server and key are configured β€” no relay or API server entries are set.


How It Works

  1. Detects the script execution directory.
  2. Creates a clean portable folder (RustDeskPortable) and user config directory.
  3. Fetches the latest tag from the official RustDesk GitHub repository.
  4. Locates the Windows x64 portable executable (no installer, no server build).
  5. Downloads and verifies it.
  6. Generates a RustDesk2.toml file with your provided ServerIP and Key.
  7. Updates the local update.log with tag and timestamp.
  8. Starts RustDesk automatically, ready to connect.

Usage

1. Download the Script

Invoke-WebRequest `
  -Uri "https://gist.github.com/michele-tn/8a824d6257147718fd8384da0fa13f7a/raw/RustDeskPortable.ps1" `
  -OutFile "RustDeskPortable.ps1"

2. Run the Script

powershell.exe -ExecutionPolicy Bypass -File .\RustDeskPortable.ps1 `
  -ServerIP "rustdesk.yourdomain.com" `
  -Key "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMyExampleKey1234567890..."

Or as a one-liner for deployment systems (RMM / GPO / Intune):

powershell.exe -ExecutionPolicy Bypass -NoProfile `
  -File "C:\Tools\RustDesk\RustDeskPortable.ps1" `
  -ServerIP "rustdesk.yourdomain.com" `
  -Key "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMyExampleKey1234567890..."

Output Overview

After successful execution:

  • βœ… RustDeskPortable\rustdesk.exe downloaded
  • βœ… RustDeskPortable\update.log updated
  • βœ… %AppData%\RustDesk\config\RustDesk2.toml created
  • πŸš€ RustDesk automatically launched and ready to use

Deployment Scenarios

You can automate this for:

  • Group Policy (GPO):
    Assign as a startup/logon script

  • RMM / MDM / Intune:
    Deploy remotely with PowerShell scripting

  • USB Toolkit:
    Carry and run from a USB drive for field operations


Troubleshooting

Problem Cause Solution
Download fails GitHub not reachable Check proxy/firewall or GitHub access
No portable exe found GitHub release format changed Verify latest release manually
Config not applied Existing TOML not replaced Script removes old config automatically
Connection error Wrong ServerIP or invalid Key Double-check your RustDesk server setup

Security Recommendations

  • Keep your public/private key pairs secure.
  • Use HTTPS for your RustDesk server.
  • Verify script integrity before deploying.
  • Restrict outbound access to trusted domains only.

Disclaimer

This script is provided "as-is", with no warranty.
Always test it in a controlled environment before mass deployment.


Author: Michele TN (original Gist)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment