Add Automate installation scripts

This commit is contained in:
Corbin 2024-06-04 11:53:52 -04:00
parent 1c7fcdacdf
commit c461d04165
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,18 @@
$ServerUrl = 'https://automate.example.com'
$ServerPass = ''
$LocationId = ''
$PackagePath = 'C:\Packages'
$AgentInstallFile = 'LabTechRemoteAgent.msi'
$AgentInstallUrl = "$ServerUrl/LabTech/Service/$AgentInstallFile"
$AgentInstallPath = Join-Path -Path $PackagePath -ChildPath $AgentInstallFile
If (!(Test-Path -PathType Container $PackagePath)) {
New-Item -ItemType Directory -Path $PackagePath
}
Write-Host "Downloading Agent Installer..."
Invoke-WebRequest -Uri $AgentInstallUrl -OutFile $AgentInstallerPath
Write-Host "Starting installation..."
msiexec.exe /i "$AgentInstallPath" /q /lv "$(Join-Path -Path $PackagePath -ChildPath $AgentInstallerName).log" SERVERADDRESS="$ServerAddress" SERVERPASS="$ServerPass" LOCATION="$LocationId"

View File

@ -0,0 +1,16 @@
$PackagePath = 'C:\Packages'
$AgentUninstallFile = 'Agent_Uninstaller.zip'
$AgentUninstallUri = 'https://s3.amazonaws.com/assets-cp/assets/$AgentUninstallFile'
$AgentUninstallPath = Join-Path -Path $PackagePath -ChildPath $AgentUninstallFile
If (!(Test-Path -PathType Container $PackagePath)) {
New-Item -ItemType Directory -Path $PackagePath
}
Write-Host "Downloading Agent Uninstaller..."
Invoke-WebRequest -Uri $AgentUninstallUri -OutFile $AgentUninstallPath
Write-Host "Expanding Agent Uninstaller..."
Expand-Archive -Path $AgentUninstallPath -DestinationPath $PackagePath -Force
Write-Host "Invoking Agent Uninstaller..."
& "$PackagePath\Agent_Uninstall.exe"