Integrate with existing remote access tool (RustDesk)

Written By Mikel from Gorelo

You can integrate Gorelo with any remote access tool that supports launching via a URL E.g RustDesk, Splashtop, AnyDesk, TeamViewer.
โ€‹
In this example, we'll use RustDesk. It is strongly recommended to host your own RustDesk server and modify the initial install script to support this.

Step 1: Create the custom asset fields

  1. Navigate to Settings -> Assets -> Custom Fields

  2. Add custom field with the following details

    • Name: RustDesk ID

    • Variable: rustdeskID

  3. Add custom field with the following details

    • Name: RustDesk Password

    • Variable: rustdeskPassword

Step 2: Create the installer file

  1. Navigate to Settings -> Asset -> Files

  2. Add a File with the following details:

    • File: Upload the latest RustDesk MSI installer

    • Variable: rustdesk

Step 3: Create the scripts

  1. Navigate to Scripts

  2. Create a script with the following details:

    • Name: Install Rustdesk

    • Content:

Example
#Install Rusdesk msiexec /i $gorelo:file.rustdesk /qn /norestart CREATESTARTMENUSHORTCUTS="N" CREATEDESKTOPSHORTCUTS="N" /l*v install.log
  1. Create a script with the following details:

    • Name: Write Rusdesk ID and Password

    • Content:

Example
$RustDeskPath = "$env:ProgramFiles\RustDesk\RustDesk.exe" # Get Rustdesk ID using the executable $RustdeskID = cmd /c "`"$RustDeskPath`" --get-id" if ($RustdeskID) { # Write ID to Gorelo custom field GoreloAction -SetCustomField -Name 'asset.rustdeskID' -Value $RustdeskID Write-Output "Rustdesk ID: $RustdeskID written to Gorelo" # Generate random 16 character password $Password = -join ((65..90) + (97..122) + (48..57) | Get-Random -Count 16 | ForEach-Object {[char]$_}) # Set the password in Rustdesk cmd /c "`"$RustDeskPath`" --password $Password" # Write password to Gorelo custom field GoreloAction -SetCustomField -Name 'asset.rustdeskPassword' -Value $Password Write-Output "Rustdesk password set and saved to Gorelo" exit 0 } else { Write-Output "Failed to get Rustdesk ID" exit 1 }

Step 4: Deploy the scripts via a policy

  1. Navigate to Policies

  2. Edit an existing policy that covers the assets you want to install and connect to via RustDesk

  3. Add a continuous Service check for RustDesk Service. Add the โ€˜Install Rustdeskโ€˜ script as a remediation step

  4. Add the 'Write Rusdesk ID and Password' script and set to repeat daily at your preferred time

  5. Save and Distribute the policy

Step 5: Create the Shortcut

  1. Navigate to Asset Shortcuts

  2. Add a new Shortcut with the following details:

    • Name: RustDesk

    • URL: rustdesk://{{$gorelo:asset.rustdeskID}}?password={{$gorelo:asset.rustdeskPassword}}

    • Pinned Name: RustDesk

You should now see the the RustDesk shortcut up the top-right corner of the Asset Detail page. If the script successfully populated the custom fields, then this shortcut will launch the RustDesk application.