2023-08-30 16:33:08 +02:00
|
|
|
---
|
|
|
|
title: Tactical RMM
|
|
|
|
weight: 100
|
|
|
|
---
|
|
|
|
|
2023-08-31 21:59:08 +02:00
|
|
|
## To Use Tactical RMM with RustDesk, you must do the following
|
2023-08-30 16:33:08 +02:00
|
|
|
|
|
|
|
1. Install your own Tactical RMM Server, following their [official docs](https://docs.tacticalrmm.com/) and open ports.
|
2023-08-31 21:59:08 +02:00
|
|
|
2. Create the following scripts (all are PowerShell).
|
2023-08-30 16:33:08 +02:00
|
|
|
3. Create a [URL Action](https://docs.tacticalrmm.com/functions/url_actions/).
|
|
|
|
4. Create [custom fields](https://docs.tacticalrmm.com/functions/custom_fields/) for the RustDesk ID and password.
|
|
|
|
5. Create [collector tasks](https://docs.tacticalrmm.com/functions/automated_tasks/#collector-tasks).
|
|
|
|
|
|
|
|
## Install Script Replace IPADDRESS and KEY
|
2023-08-31 21:59:08 +02:00
|
|
|
```ps
|
2023-08-30 16:33:08 +02:00
|
|
|
$ErrorActionPreference= 'silentlycontinue'
|
|
|
|
|
2023-08-31 21:59:08 +02:00
|
|
|
If (!(Test-Path C:\Temp)) {
|
|
|
|
New-Item -ItemType Directory -Force -Path C:\Temp > null
|
2023-08-30 16:33:08 +02:00
|
|
|
}
|
|
|
|
|
2023-08-31 21:59:08 +02:00
|
|
|
cd C:\Temp
|
2023-08-30 16:33:08 +02:00
|
|
|
|
2023-09-13 23:23:22 +02:00
|
|
|
Invoke-WebRequest "https://github.com/rustdesk/rustdesk/releases/download/1.2.2/rustdesk-1.2.2-x86_64.exe" -Outfile "rustdesk.exe"
|
2023-08-30 16:33:08 +02:00
|
|
|
Start-Process .\rustdesk.exe --silent-install -wait
|
|
|
|
|
|
|
|
$ServiceName = 'Rustdesk'
|
|
|
|
$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
|
|
|
|
|
|
|
|
if ($arrService -eq $null)
|
|
|
|
{
|
|
|
|
Start-Sleep -seconds 20
|
|
|
|
}
|
|
|
|
|
|
|
|
while ($arrService.Status -ne 'Running')
|
|
|
|
{
|
|
|
|
Start-Service $ServiceName
|
|
|
|
Start-Sleep -seconds 5
|
|
|
|
$arrService.Refresh()
|
|
|
|
}
|
|
|
|
net stop rustdesk
|
|
|
|
|
|
|
|
$username = ((Get-WMIObject -ClassName Win32_ComputerSystem).Username).Split('\')[1]
|
|
|
|
Remove-Item C:\Users\$username\AppData\Roaming\RustDesk\config\RustDesk2.toml
|
|
|
|
New-Item C:\Users\$username\AppData\Roaming\RustDesk\config\RustDesk2.toml
|
|
|
|
Set-Content C:\Users\$username\AppData\Roaming\RustDesk\config\RustDesk2.toml "rendezvous_server = 'IPADDRESS' `nnat_type = 1`nserial = 0`n`n[options]`ncustom-rendezvous-server = 'IPADDRESS'`nkey = 'KEY='`nrelay-server = 'IPADDRESS'`napi-server = 'https://IPADDRESS'"
|
|
|
|
Remove-Item C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk2.toml
|
|
|
|
New-Item C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk2.toml
|
|
|
|
Set-Content C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk2.toml "rendezvous_server = 'IPADDRESS' `nnat_type = 1`nserial = 0`n`n[options]`ncustom-rendezvous-server = 'IPADDRESS'`nkey = 'KEY='`nrelay-server = 'IPADDRESS'`napi-server = 'https://IPADDRESS'"
|
|
|
|
|
|
|
|
net start rustdesk
|
|
|
|
```
|
|
|
|
|
|
|
|
## RustDesk Get ID (Collector Script needs Custom Agent Field)
|
|
|
|
|
2023-08-31 21:59:08 +02:00
|
|
|
```ps
|
2023-08-30 16:33:08 +02:00
|
|
|
$ErrorActionPreference= 'silentlycontinue'
|
|
|
|
|
|
|
|
cd $env:ProgramFiles\RustDesk\
|
|
|
|
.\RustDesk.exe --get-id | out-host
|
|
|
|
```
|
|
|
|
|
2023-09-22 23:13:37 +02:00
|
|
|
## Create Script to be used as a Check
|
|
|
|
|
|
|
|
```
|
2023-08-30 16:33:08 +02:00
|
|
|
$ErrorActionPreference= 'silentlycontinue'
|
|
|
|
|
2023-09-22 23:13:37 +02:00
|
|
|
$confirmation_file = "C:\program files\RustDesk\rdrunonce.txt"
|
2023-08-31 14:03:40 +02:00
|
|
|
|
|
|
|
if ([System.IO.File]::Exists($confirmation_file)) {
|
|
|
|
echo "Confirmation file exists"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-09-22 23:13:37 +02:00
|
|
|
echo "Confirmation file doesn't exists"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
## RustDesk Set and Get Password (Collector Script needs Custom Agent Field) to run on Check Failure
|
|
|
|
```
|
2023-08-31 14:03:40 +02:00
|
|
|
$ErrorActionPreference= 'silentlycontinue'
|
|
|
|
|
2023-09-22 23:13:37 +02:00
|
|
|
$confirmation_file = "C:\program files\RustDesk\rdrunonce.txt"
|
|
|
|
|
2023-08-30 16:33:08 +02:00
|
|
|
net stop rustdesk > null
|
|
|
|
$ProcessActive = Get-Process rustdesk -ErrorAction SilentlyContinue
|
|
|
|
if($ProcessActive -ne $null)
|
|
|
|
{
|
|
|
|
stop-process -ProcessName rustdesk -Force
|
|
|
|
}
|
|
|
|
|
2023-09-22 23:13:37 +02:00
|
|
|
$rustdesk_pw = (-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}))
|
2023-08-30 16:33:08 +02:00
|
|
|
Start-Process "$env:ProgramFiles\RustDesk\RustDesk.exe" "--password $rustdesk_pw" -wait
|
|
|
|
Write-Output $rustdesk_pw
|
|
|
|
|
|
|
|
net start rustdesk > null
|
2023-09-22 23:13:37 +02:00
|
|
|
|
2023-08-31 14:03:40 +02:00
|
|
|
New-Item $confirmation_file > null
|
2023-09-22 23:13:37 +02:00
|
|
|
|
2023-08-30 16:33:08 +02:00
|
|
|
```
|
2023-08-31 21:59:08 +02:00
|
|
|
|
2023-08-30 16:33:08 +02:00
|
|
|
## RustDesk URL Action
|
|
|
|
```
|
|
|
|
rustdesk://connection/new/{{agent.rustdeskid}}?password={{agent.rustdeskpwd}}
|
2023-08-31 21:59:08 +02:00
|
|
|
```
|
|
|
|
|
2023-08-30 16:33:08 +02:00
|
|
|
## Add Custom Agent Fields
|
|
|
|
`rustdeskid Type = Text` </br>
|
|
|
|
`rustdeskpwd Type = Text`
|