Skip to main content
All CollectionsAgentsWindows Agent
How to Reinstall the Liongard Agent on Windows
How to Reinstall the Liongard Agent on Windows

Reinstalling the Liongad Agent. Deploy the Liongard agent via RMM. Mass deployment of the Liongard Agent.

Updated over 4 months ago

This guide provides detailed instructions on how to reinstall the Liongard Agent on Windows systems. This script can also be adapted for use with your Remote Monitoring and Management (RMM) tools or Group Policy to facilitate mass installations.

Prerequisites

Before running the script, ensure you have:

  • Administrative rights on the system where the installation will occur.

  • Your Liongard deployment's URL, access key, and secret.

Script

# Define application variables
$application = Get-WmiObject -Class Win32_Product -Filter "Name = 'Liongard Agent'"
$application2 = Get-WmiObject -Class Win32_Product -Filter "Name = 'RoarAgent'"
$Folder = "AddFolderPathHere" # Specify the folder path for installation files
$URL = "XXX.app.liongard.com" # Replace with your Liongard URL
$Key = "PasteKeyHere" # Replace with your access key
$Secret = "PasteSecretHere" # Replace with your secret
$Environment = "PasteEnvironmentNameHere" # Replace with your environment name

# Ensure using TLS 1.2 for secure connections
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12

# Uninstall previous installations if found
if ($application) {
Write-Host "A recent version of the Liongard Agent was found! Uninstalling..."
$application.Uninstall()
} elseif ($application2) {
Write-Host "An old version of RoarAgent was found. Uninstalling..."
$application2.Uninstall()
} else {
Write-Host "No Liongard Agent installation was found. Proceeding with installation..."
}

Start-Sleep -Seconds 10

# Check and prepare the installation directory
Write-Host "Checking if folder [$Folder] exists..."
if (Test-Path -Path $Folder) {
Write-Host "Path exists! Downloading Liongard Agent installer..."
Start-Sleep -Seconds 2
Invoke-WebRequest -Uri "https://agents.static.liongard.com/LiongardAgent-lts.msi" -OutFile "$Folder\LiongardAgent-lts.msi"
} else {
Write-Host "Path does not exist. Creating directory at [$Folder]..."
New-Item -Path $Folder -ItemType Directory
if (Test-Path -Path $Folder) {
Write-Host "Directory created successfully! Downloading Liongard Agent installer..."
Start-Sleep -Seconds 2
Invoke-WebRequest -Uri "https://agents.static.liongard.com/LiongardAgent-lts.msi" -OutFile "$Folder\LiongardAgent-lts.msi"
} else {
Write-Host "Failed to create directory, please check permissions. Exiting script..."
Start-Sleep -Seconds 10
Exit
}
}

# Install the Liongard Agent
Write-Host "Installing the Liongard Agent..."
msiexec.exe /i "$Folder\LiongardAgent-lts.msi" LIONGARDURL=$URL LIONGARDACCESSKEY=$Key LIONGARDACCESSSECRET=$Secret LIONGARDENVIRONMENT=`"$Environment`" LIONGARDAGENTNAME="$env:computername" /qn /norestart /L*V "$Folder\AgentInstall.log"
Start-Sleep -Seconds 2
Write-Host "Installation complete, check the install log at [$Folder] for details."
Start-Sleep -Seconds 5
Write-Host "Exiting script..."
Exit


Post-Installation

After the script completes:

  • Verify the installation by checking the Agent status in your Liongard dashboard.

  • Review the installation log (AgentInstall.log) for any potential errors during the installation process.

Disclaimer

Liongard provides this script as is and is not responsible for modifications or misuse. Please ensure you adapt the script appropriately for your environment to avoid any disruptions.

Did this answer your question?