Skip to content

Instantly share code, notes, and snippets.

@asheroto
Last active October 30, 2025 01:39
Show Gist options
  • Select an option

  • Save asheroto/162e396e8b041bea2f90fe3d8ff94348 to your computer and use it in GitHub Desktop.

Select an option

Save asheroto/162e396e8b041bea2f90fe3d8ff94348 to your computer and use it in GitHub Desktop.
Creates a one-line command to download and install a TacticalRMM agent.

TacticalRMM One-Line Agent Deployer

Creates a one-line command to download and install a TacticalRMM agent. It works by creating a script and converting it into a base64 command. It then copies the command to your clipboard, so you can paste it / save it as needed.

It also adds a temporary exclusion in Windows Defender to ensure the agent installs without any false positives. The exclusion is removed after the agent download is deleted.

Example

example

Optional - If you want to see the script that runs, you can convert the base64 encoding back to text...

example reverse

# TacticalRMM One-Line Agent Deployer
#
# Description:
# This script takes the download agent URL and creates a one-line command that will download and install the agent
# It works by creating a script and converting it into a base64 command
# It then copies the command to your clipboard, so you can paste it / save it as needed
#
# Author: asheroto
# Author GitHub: https://github.com/asheroto
#
# Version 0.2
Write-Output ""
$agentURL = Read-Host "Agent URL"
$script = @'
# Set agent path
$agentPath = $(Join-Path -Path $($ENV:TEMP) -ChildPath "agent.exe")
# Add exclusion in Windows Defender
Add-MpPreference -ExclusionPath $agentPath
# Download agent
wget {{agentURL}} -o $agentPath
# Run agent silently
Start-Process -FilePath $agentPath -Args "-silent" -Wait
# Remove downloaded agent file
rm $agentPath
# Remove exclusion in Windows Defender
Remove-MpPreference -ExclusionPath $agentPath
'@ -Replace "{{agentURL}}",$agentURL
$s = $script
$j = [PSCustomObject]@{
"Script" = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($s))
} | ConvertTo-Json -Compress
$oneline = "[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String(('" + $j + "' | ConvertFrom-Json).Script)) | iex"
$c = [convert]::ToBase64String([System.Text.encoding]::Unicode.GetBytes($oneline))
$output = ("Powershell -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Encoded " + $c)
$output | Set-Clipboard
Write-Output ""
Write-Output "One line command copied to clipboard:"
Write-Output ""
Write-Output $output
Write-Output ""
@asheroto
Copy link
Copy Markdown
Author

I'm really not sure, haha. My memory is failing me. I wrote this in 2021 and haven't used TacticalRMM since around that time.

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