$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"