2023-09-29 16:49:05 -04:00
|
|
|
param(
|
|
|
|
|
[Parameter(Mandatory=$true)][string]$URL,
|
|
|
|
|
[Parameter(Mandatory=$false)][string]$AGENT_FILENAME="SyncroInstaller.msi",
|
|
|
|
|
[Parameter(Mandatory=$false)][switch]$FORCE=$false
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Delete this script
|
|
|
|
|
Remove-Item $MyInvocation.MyCommand.Path -Force
|
|
|
|
|
|
|
|
|
|
# Exit early if we don't need to install the agent
|
|
|
|
|
If ( ($FORCE -eq $false) -and ((Test-Path "${Env:ProgramFiles}\RepairTech\Syncro\Syncro.App.Runner.exe") -or (Test-Path "${Env:ProgramFiles(x86)}\RepairTech\Syncro\Syncro.App.Runner.exe")) ) { Exit }
|
|
|
|
|
|
|
|
|
|
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
|
2023-10-05 12:47:08 -04:00
|
|
|
$AGENT_INSTALLER = '{0}{1}' -f (Get-TempPath), $AGENT_FILENAME
|
2023-09-29 16:49:05 -04:00
|
|
|
|
|
|
|
|
# Download agent installer
|
|
|
|
|
Download-File -URL $URL -File "${AGENT_INSTALLER}"
|
|
|
|
|
|
|
|
|
|
# Install the agent
|
|
|
|
|
LogMsg "Installing Syncro agent from ""${AGENT_INSTALLER}"""
|
|
|
|
|
Try { Start-Process "msiexec.exe" -ArgumentList "/i ""${AGENT_INSTALLER}"" /qn /norestart" -Wait }
|
|
|
|
|
Catch { LogErr $_.Exception.Message }
|
|
|
|
|
|
|
|
|
|
# Delete the agent installer
|
|
|
|
|
LogMsg "Deleting ""${AGENT_INSTALLER}"""
|
|
|
|
|
Try { Remove-Item $AGENT_INSTALLER -Force }
|
|
|
|
|
Catch { LogErr $_.Exception.Message }
|