added additional test for x64 systems
correctly identified previous installations removed quotes from URL in install statement
This commit is contained in:
@@ -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." }
|
||||
|
||||
Reference in New Issue
Block a user