32 lines
1.2 KiB
PowerShell
32 lines
1.2 KiB
PowerShell
param(
|
|
[Parameter(Mandatory=$true)][int]$CUSTOMER_ID,
|
|
[Parameter(Mandatory=$true)][string]$INTEGRATOR_ID,
|
|
[Parameter(Mandatory=$false)][string]$AGENT_FILENAME="EmberkomAgentSetup.exe"
|
|
)
|
|
|
|
## Source the Tools.ps1 script
|
|
Function SourceTools
|
|
{ . $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1'))) }
|
|
. SourceTools
|
|
|
|
## Build the path for $AGENT_INSTALLER
|
|
$AGENT_INSTALLER = '{0}{1}' -f (GetTempPath), $AGENT_FILENAME
|
|
|
|
## Make sure we need to install the agent
|
|
If ( !(Test-Path "${Env:ProgramFiles}\ATERA Networks\AteraAgent\AteraAgent.exe") )
|
|
{
|
|
## Download agent and get path
|
|
$AGENT_INSTALLER = Download-File -URL "http://emberkom.servicedesk.atera.com/GetAgent/Msi/?customerId=${CUSTOMER_ID}&integratorLogin=${INTEGRATOR_ID}" -File $AGENT_INSTALLER
|
|
|
|
## Install the agent
|
|
Try { Start-Process "msiexec.exe" -ArgumentList "/i ""${AGENT_INSTALLER}"" /qn /norestart" -Wait }
|
|
Catch { LogErr $_.Exception.Message }
|
|
|
|
## Remove agent installer
|
|
Try { Remove-Item $AGENT_INSTALLER -Force }
|
|
Catch { LogErr $_.Exception.Message }
|
|
|
|
} Else { LogMsg "Atera agent is already installed on this endpoint." }
|
|
|
|
|