powershell-scripts/rmm/automate/Install-Automate.ps1

24 lines
937 B
PowerShell

#!ps
#timeout=3000000
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
$PackagePath = 'C:\Packages'
$ServerUrl = 'https://automate.example.com'
$ServerPass = ''
$LocationId = ''
$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..."
(New-Object Net.WebClient).DownloadFile($AgentInstallUrl, $AgentInstallPath)
Write-Host "Starting installation..."
msiexec.exe /i "$AgentInstallPath" /q /lv "$($AgentInstallPath).log" SERVERADDRESS="$ServerUrl" SERVERPASS="$ServerPass" LOCATION="$LocationId"
Write-Host "Log saved at $($AgentInstallPath).log"