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

21 lines
857 B
PowerShell

#!ps
#timeout=3000000
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
$PackagePath = 'C:\Packages'
$AgentUninstallFile = 'Agent_Uninstaller.zip'
$AgentUninstallUrl = "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..."
(New-Object Net.WebClient).DownloadFile($AgentUninstallUrl, $AgentUninstallPath)
Write-Host "Expanding Agent Uninstaller..."
Expand-Archive -Path $AgentUninstallPath -DestinationPath $PackagePath -Force
Write-Host "Invoking Agent Uninstaller..."
& "$PackagePath\Agent_Uninstall.exe"