diff --git a/rmm/automate/Install-Automate.ps1 b/rmm/automate/Install-Automate.ps1 new file mode 100644 index 0000000..b5221f4 --- /dev/null +++ b/rmm/automate/Install-Automate.ps1 @@ -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" \ No newline at end of file diff --git a/rmm/automate/Uninstall-Automate.ps1 b/rmm/automate/Uninstall-Automate.ps1 new file mode 100644 index 0000000..84f83c9 --- /dev/null +++ b/rmm/automate/Uninstall-Automate.ps1 @@ -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" \ No newline at end of file