Skip to main content

Liongard Agent Install Script

Silently install the Liongard Agent using LGAgentScript.ps1

Updated this week

This guide contains everything required to deploy the Liongard Agent in a silent, automated, and duplicate-safe manner using the LGAgentScript PowerShell script.

You can download the script by clicking the following link. Just be sure to input your variables and rename it to"LGAgentScript.ps1" before use:

Scripts are named LGAgentScript_YYYYMMDD to indicate the build date; YYYYMMDD reflects when the script was generated so partners can confirm they’re using the latest version.

This script supports:

  • Mass RMM deployment

  • Optional uninstall + cleanup prior to reinstall

  • Environment name matching

  • Machine identity collision prevention

  • Safe backend record deletion (optional)


🧠 What LGAgentScript.ps1 Does

Functionality

Description

Silent installation

MSI deployment without prompts

Validates configuration inputs

Prevents empty or placeholder values

Environment name matching

Matches the Environment parameter with existing environments in Liongard

Detects MachineGuid collisions

Prevents Agent overwrite scenarios

Generates override DEVICEGUID

Only when a collision is confirmed

Optional uninstall prior to install

Removes service, folder, registry keys

Optional deletion of backend record

Only when the scoring threshold is met

Transcript logging

Creates a full script execution trace

Installer logging

Captures MSI installer result


βš™ Script Configuration in LGAgentScript.ps1

Update this section at the top of the file or map via RMM variables:

To Generate the Token Key(s) & Secret(s), please follow the below steps

  1. Click on your name at the top right corner

  2. Select "Account Settings"

  3. Select "Access Token"

  4. Select "Generate New Token"

  5. Select "Liongard API Token"
    This will provide you with #ApiTokenKey & #ApiTokenSecret

  6. Select "Agent Install Token"
    This will provide you with #AgentTokenKey & #AgentTokenSecret


πŸ“„ Script Outline

When running the script:

  1. Validates configuration values

  2. Optionally uninstalls any existing Liongard Agent

  3. Attempts to match the provided Environment variable with an existing Liongard environment

  4. Detects MachineGuid conflicts with existing Agents

  5. Generates a DEVICEGUID override if necessary

  6. Calls the MSI installer silently

  7. Evaluates MSI success & logs outcomes

  8. Records execution details in the transcript log

  9. Exits with a clean success or failure code for RMM interpretation


🧯 Troubleshooting & Logs

LGAgentScript.ps1 generates two log files every run.

Log

Description

Location

Script Transcript & Diagnostic Log

Machine identity decisions, uninstall logic, deletion scoring, environment processing

C:\Liongard\LGAgentScript_<timestamp>.log

MSI Installer Log

MSI exit code, errors, and silent failure reasoning

C:\Liongard\AgentInstall.log


If Deployment Fails

πŸ“Œ Check the MSI Log:

Path β†’ C:\Liongard\AgentInstall.log

Useful for:

  • 1603 Fatal error

  • Blocked by a security tool

  • Incorrect MSI parameters

  • Missing permissions

πŸ“Œ Check the Script Transcript Log:

Path β†’ C:\Liongard\LGAgentScript_<timestamp>.log

Shows:

  • Matched identities and scoring

  • Whether the DEVICEGUID override was required

  • Whether removal was allowed

  • Why backend deletion was skipped


⚠ Disclaimer

Liongard provides this script as-is and is not responsible for custom modifications or misuse. Always validate configuration values and test in a controlled environment prior to mass deployment to avoid unintended disruptions.

Did this answer your question?