From c94854e6e999791917fbe1dd21e64d70a9e39584 Mon Sep 17 00:00:00 2001 From: dyoder Date: Mon, 8 Feb 2021 16:36:42 -0500 Subject: [PATCH] added additional test for x64 systems correctly identified previous installations removed quotes from URL in install statement --- Install-AteraAgent.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Install-AteraAgent.ps1 b/Install-AteraAgent.ps1 index b95efe8..81c9a90 100644 --- a/Install-AteraAgent.ps1 +++ b/Install-AteraAgent.ps1 @@ -14,12 +14,15 @@ Function SourceTools #$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" ) { $INSTALL = $false } Else { $INSTALL = $true } +If ( (Test-Path "${Env:ProgramFiles}\ATERA Networks\AteraAgent\AteraAgent.exe") -or (Test-Path "${Env:ProgramFiles(x86)}\ATERA Networks\AteraAgent\AteraAgent.exe") ) +{ $INSTALL = $false ; $PreviousInstall = $true } Else { $INSTALL = $true ; $PreviousInstall = $false } + If ( $FORCE ) { $INSTALL = $true } + If ( $INSTALL ) { ## Uninstall if $FORCE is true - If ( $FORCE ) { + If ( $PreviousInstall ) { LogMsg "Uninstalling previously installed agent" $UninstallScript = Download-File -URL 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Uninstall-AteraAgent.bat' Try { Start-Process "cmd.exe" -ArgumentList "/c ""${UninstallScript}""" -Wait } @@ -33,7 +36,7 @@ If ( $INSTALL ) { ## Install the agent LogMsg "Installing Atera agent from: ${URL}" - Try { Start-Process "msiexec.exe" -ArgumentList "/i ""${URL}"" /qn /norestart INTEGRATORLOGIN=${INTEGRATOR_ID} COMPANYID=${CUSTOMER_ID}" -Wait } + Try { Start-Process "msiexec.exe" -ArgumentList "/i ${URL} /qn /norestart INTEGRATORLOGIN=${INTEGRATOR_ID} COMPANYID=${CUSTOMER_ID}" -Wait } Catch { LogErr $_.Exception.Message } } Else { LogMsg "Atera agent is already installed on this endpoint." }