The following section provides a PowerShell script that will allow users to download the AppAssure 5 installation files without using a web browser or application GUI.
Warning: All scripts provided in this article are meant to be used as examples and are not supported by AppAssure. Click here for more information on PowerShell support.
The script below allows users to do the following:
Please note that real-time updating of the status is not possible, as this script is a single threaded script.
#this script downloads the main AppAssureComponents from a Command Line
Write-host “`r`nDownload AppAssure Installers from a Command Line`r`n___________________________________________________`r`n”
#Change the line below to reflect the desired build
$buildversion = “5.3.5.64611″
#Seet the root URL
$root = “https://s3.amazonaws.com/appassure5releases/”
#Select the component to download
$files = “Core-X64-”,”Agent-X64-”,”Agent-X86-”,”LocalMountUtility-X64-”,”LocalMountUtility-X86-”
$index = Read-Host “File to download `r`n0. Core`r`n1. Agent x64`r`n2. Agent x86`r`n3. Local mount Utility x64`r`n4. Local mount Utility x86`r`nEnter here”
if (0,1,2,3,4 -contains $index)
{
$file = $files[$index]
#Select the build
$build = Read-Host “Enter build # [default: $($buildversion)]”
if ($build -eq “”){$build = $($buildversion+”.exe”)}
else{$build = $($build+”.exe”)}
#Select the destination directory. Create a new one if it does not exist
$downloads = $home + “\downloads”
$path = Read-Host “Enter destination directory path [default $($downloads)]”
if ($path -eq “”){$path = $downloads}
else { if(!(Test-Path $path)) {Write-Host “Creating New Directory…” -Foreground Yellow; New-Item $path -Type Directory; Write-Host “`r`n”}}
$filename= $($path +”\”+ $file + $build)
#check if file already exists and choose to overwrite
if(Test-Path $filename){$a = Read-Host “`r`nFile already exists. [Q]uit; any other key, Overwite”
if ($a.ToLower() -eq “q”){exit}
}
#build download
$url = $root + $file + $build
$webclient = new-object System.net.webclient
Write-Host “Downloading $($file+$build). Please Wait…”
$webclient.downloadfile($url,$filename)
#verify if OK
if(Test-Path $filename){Write-Host “Downloaded file successfully” -ForegroundColor Yellow}
else {Write-Host “Unable to access $url” -ForegroundColor Red}
}