Anyone have LionGard Script

Anyone already have a good script here you want to share. I’m just starting to put something together if no one else has something. There isn’t anything in the community script library, and the documentation from liongard doesn’t give a full script.

Well may have found on for Continuum that should work.

<#
.SYNOPSIS
    Installs the Liongard Agent via the Continuum RMM.

.DESCRIPTION
    Provides a paramaterized script that lets you install the Liongard Agent based on the specific setup you want.

.PARAMETER LiongardUrl
  The Liongard url for your instance, e.g. us1.app.liongard.com
  
  $LiongardUrl = 'xxxxx.app.liongard.com'

.PARAMETER LiongardAccessKey
  The Liongard API access key generated from Liongard
  
  $LiongardAccessKey = "xxxxxx"

.PARAMETER LiongardAccessSecret
  The Liongard API secret generated from Liongard
  
  $LiongardAccessSecret = "xxxxxx"

.PARAMETER LiongardSvcUsername
  The username of the Liongard service account to use associate the service with, i.e. "Run As"

  $LiongardSvcUsername = "DOMAIN\LiongardSvcAccount"

.PARAMETER LiongardSvcPassword
  The password of the Liongard service account to use associate the service with, i.e. "Run As"

  $LiongardSvcPassword = "xxxxxx"

.PARAMETER UseSiteName
    Default to False. If set it will associate the agent to the Environment which matches the site name. Change this to $True if and only if the Liongard Environment names EXACTLY MATCH the Continuum Site names. We recommend you model Liongard environment names after your Continuum site names as they are easy to change and Continuum is not.
NOTE: The Continuum agent does not produce the 'SITENAME' registry key for ~30 minutes after initial Continuum agent installation. You will need to run this script after the Continuum agent has properly registered and the registry key for the site name is populated if you use this feature.

    $UseSiteName= "$True"

.PARAMETER Environment
    If you want to manually specify the Environment in Liongard to associate the agent with.

    $Environment = "Liongard"

.NOTES
    Version: 1.0.0
    Date: 09/05/2019
#>
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$X64 = 64
$X86 = 32
$InstallerName = "LiongardAgent-lts.msi"
$DownloadURL = "https://agents.static.liongard.com/" + $InstallerName
$InstallerPath = Join-Path $Env:TMP $InstallerName
$DebugLog = Join-Path $Env:TMP LiongardDebug.log
$MsiLog = Join-Path $Env:TMP install.log


<#
Edit the following parameters to include your Liongard URL, Access Key and Secret, (optionally) the Username and Password to a Service Account, and (optionally) the name of the Environment that you would like this Agent to be associated to in Liongard
#>

$LiongardURL = 'xxxxx.app.liongard.com'
$LiongardAccessKey = "xxxxxx"
$LiongardAccessSecret = "xxxxxx"
$LiongardSvcUsername = "DOMAIN\LiongardSvcAccount"
$LiongardSvcPassword = "xxxxxx"
$Environment = "xxxxxx" 


function Get-TimeStamp {
    return "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date)   
}
function Get-WindowsArchitecture {
    If ($env:ProgramW6432) {
        $WindowsArchitecture = $X64
    } Else {
        $WindowsArchitecture = $X86
    }
    return $WindowsArchitecture
}
function Get-ContinuumKeyPath {
    $WindowsArchitecture = Get-WindowsArchitecture
    If ($WindowsArchitecture -eq $X86) {
        $ContinuumKeyPath = "HKLM:\SOFTWARE\SAAZOD"
    } ElseIf ($WindowsArchitecture -eq $X64) {
        $ContinuumKeyPath = "HKLM:\SOFTWARE\WOW6432Node\SAAZOD"
    } Else {
        $ArchitectureError = "Failed to determine the Windows Architecture. Received $WindowsArchitecure."
        Add-Content $DebugLog "$(Get-TimeStamp) $ArchitectureError"
        throw $ArchitectureError
    }
    return $ContinuumKeyPath
}
function Get-ContinuumKeyObject {
    $ContinuumKeyPath = Get-ContinuumKeyPath
    If ( ! (Test-Path $ContinuumKeyPath)) {
        $ContinuumRegistryError = "The expected Continuum registry key $ContinuumKeyPath did not exist."
        Add-Content $DebugLog "$(Get-TimeStamp) $ContinuumRegistryError"
        throw $ContinuumRegistryError
    }
    
    $ContinuumKeyObject = Get-ItemProperty $ContinuumKeyPath
    
    If ( ! ($ContinuumKeyObject)) {
        $ContinuumRegistryError = "The Continuum registry key was empty."
        Add-Content $DebugLog "$(Get-TimeStamp) $ContinuumRegistryError"
        throw $ContinuumRegistryError
    }
    return $ContinuumKeyObject
}
function Get-SiteCode {
    $ContinuumValueName = "SiteCode"
    $ContinuumKeyObject = Get-ContinuumKeyObject
    If ( ! (Get-Member -inputobject $ContinuumKeyObject -name $ContinuumValueName -Membertype Properties)) {
        $ContinuumKeyPath = Get-ContinuumKeyPath
        $ContinuumRegistryError = ("The expected Continuum registry value $ContinuumValueName did not exist within " +
                                   "$ContinuumKeyPath")
        Add-Content $DebugLog "$(Get-TimeStamp) $ContinuumRegistryError"
        throw $ContinuumRegistryError
    }
    $SiteCode = $ContinuumKeyObject.$ContinuumValueName
    return $SiteCode
}

function Get-SiteName {
    $ContinuumValueName = "SITENAME"
    $ContinuumKeyObject = Get-ContinuumKeyObject
    If ( ! (Get-Member -inputobject $ContinuumKeyObject -name $ContinuumValueName -Membertype Properties)) {
        $ContinuumKeyPath = Get-ContinuumKeyPath
        $ContinuumRegistryError = ("The expected Continuum registry value $ContinuumValueName did not exist within " +
                                   "$ContinuumKeyPath")
        Add-Content $DebugLog "$(Get-TimeStamp) $ContinuumRegistryError"
        throw $ContinuumRegistryError
    }
    $SiteName = $ContinuumKeyObject.$ContinuumValueName
    return $SiteName
}
function Get-Installer {
    $WebClient = New-Object System.Net.WebClient
    try {
        $WebClient.DownloadFile($DownloadURL, $InstallerPath)
    } catch {
        Add-Content $DebugLog "$(Get-TimeStamp) $_.Exception.Message"
    }
    If ( ! (Test-Path $InstallerPath)) {
        $DownloadError = "Failed to download the Liongard Agent Installer from $DownloadURL"
        Add-Content $DebugLog "$(Get-TimeStamp) $DownloadError"
        throw $DownloadError
    }
}

# Generate the agent name here. We use Continuum SiteCode + Name of the computer to ensure uniqueness
function Get-AgentName {
    $SiteCode = Get-SiteCode
    $AgentName = $SiteCode + "-" + $env:computername
    return $AgentName
}

function Install-Liongard {
    $AgentName = Get-AgentName
    If ( ! (Test-Path $InstallerPath)) {
        $InstallerError = "The installer was unexpectedly removed from $InstallerPath"
        Add-Content $DebugLog "$(Get-TimeStamp) $InstallerError"
        throw $InstallerError
    }
   
    $LiongardArgs = "LiongardURL=" + $LiongardURL + " LiongardACCESSKEY=" + $LiongardAccessKey + " LiongardACCESSSECRET=" + $LiongardAccessSecret + " LiongardAGENTNAME=" + "`"$AgentName`""
    If ($LiongardSvcUsername -and $LiongardSvcUsername.Length -gt 0) {
        $LiongardArgs += " LiongardAGENTSERVICEACCOUNT=" + "`"$LiongardSvcUsername`"" + " LiongardAGENTSERVICEPASSWORD=" + "`"$LiongardSvcPassword`""
    }
    
    If ($UseSiteName) {
      $SiteName = Get-SiteName
      $LiongardArgs += " LiongardENVIRONMENT=" + "`"$SiteName`""
    } ElseIf ($Environment) {
        $LiongardArgs += " LiongardENVIRONMENT=" + "`"$Environment`""
    }

    $InstallArgs = @(
        "/i"
        "`"$InstallerPath`""
        $LiongardArgs
        "/qn"
        "/L*V"
        "`"$MsiLog`""
        "/norestart"
    )

    Start-Process msiexec.exe -ArgumentList $InstallArgs -Wait -PassThru
}
function main {
    If (!(Get-Service "Liongardr Agent" -ErrorAction SilentlyContinue)) {
        Get-Installer # Download the MSI
      Install-Liongard # Install the MSI
    }
}
main

Was you able to get a Liongard Script mass deployment script to work from Syncro?

ya, i think it worked ok. Although we backed off liongard just a bit. It’s a very complicated setup and we decided to wait to fully utilize.