minor updates
This commit is contained in:
+10
-14
@@ -1,25 +1,22 @@
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][int]$CUSTOMER_ID,
|
||||
[Parameter(Mandatory=$true)][int]$CUSTOMER_ID=1,
|
||||
[Parameter(Mandatory=$true)][string]$INTEGRATOR_ID,
|
||||
[Parameter(Mandatory=$false)][string]$AGENT_FILENAME="AteraAgentSetup.msi",
|
||||
[Parameter(Mandatory=$false)][switch]$FORCE
|
||||
)
|
||||
|
||||
## Replace the @ with %40 - not sure why this is necessary, but it is
|
||||
# Replace the '@' with '%40' - not sure why this is necessary, but it is
|
||||
$INTEGRATOR_ID = $INTEGRATOR_ID.Replace('@','%40')
|
||||
|
||||
## Set the Atera URL for your specific environment
|
||||
$BASE_URL = 'https://emberkom.atera.com'
|
||||
|
||||
## Source the Tools.ps1 script
|
||||
# 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
|
||||
# Build the path for $AGENT_INSTALLER
|
||||
$AGENT_INSTALLER = '{0}{1}' -f (GetTempPath), $AGENT_FILENAME
|
||||
|
||||
## Make sure we need to install the agent
|
||||
# Make sure we need to install the agent
|
||||
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 }
|
||||
|
||||
@@ -27,7 +24,7 @@ If ( $FORCE ) { $INSTALL = $true }
|
||||
|
||||
If ( $INSTALL ) {
|
||||
|
||||
## Uninstall if $FORCE is true
|
||||
# Uninstall if $FORCE is true
|
||||
If ( $PreviousInstall ) {
|
||||
LogMsg "Uninstalling previously installed agent"
|
||||
$UninstallScript = Download-File -URL 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Uninstall-AteraAgent.bat'
|
||||
@@ -37,22 +34,21 @@ If ( $INSTALL ) {
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Download agent installer
|
||||
# Download agent installer
|
||||
Download-File -URL "https://app.atera.com/GetAgent/Msi/?customerId=${CUSTOMER_ID}&integratorLogin=${INTEGRATOR_ID}" -File "${AGENT_INSTALLER}"
|
||||
#Download-File -URL 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/resources/AteraAgentSetup.msi' -File "${AGENT_INSTALLER}"
|
||||
|
||||
## Install the agent
|
||||
# Install the agent
|
||||
LogMsg "Installing Atera agent"
|
||||
Try { Start-Process "msiexec.exe" -ArgumentList "/i ""${AGENT_INSTALLER}"" /qn /norestart" -Wait }
|
||||
#Try { Start-Process "msiexec.exe" -ArgumentList "/i ""${AGENT_INSTALLER}"" /qn /norestart INTEGRATORLOGIN=${INTEGRATOR_ID} COMPANYID=${CUSTOMER_ID}" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
|
||||
## Delete the agent installer
|
||||
# Delete the agent installer
|
||||
LogMsg "Deleting ""${AGENT_INSTALLER}"""
|
||||
Try { Remove-Item $AGENT_INSTALLER -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
|
||||
} Else { LogMsg "Atera agent is already installed on this endpoint." }
|
||||
|
||||
# Delete this script
|
||||
Remove-Item $MyInvocation.MyCommand.Path -Force
|
||||
|
||||
|
||||
Reference in New Issue
Block a user