# Reolink Client # 2011-2019 foo.li systeme + software $release = '7.2.2.31' $packageName = 'reolink-client' $fileType = 'exe' $silentArgs = '/SILENT' $url = 'https://s3.amazonaws.com/reolink-storage/website/client/Reolink+Client+Windows+v' + $version + '+x32bit.zip' $url64 = 'https://s3.amazonaws.com/reolink-storage/website/client/Reolink+Client+Windows+v' + $version + '+x64bit.zip' $unpackDir = New-Item "${ENV:TEMP}\reolink" -ItemType Directory -Force $unpackFile = "${ENV:TEMP}\reolink.zip" $setup32 = 'Reolink Client Windows v' + $version + ' x32bit.exe' $setup64 = 'Reolink Client Windows v' + $version + ' x64bit.exe' $setupFile = Join-Path "$unpackDir" "$setup32" $setupFile64 = Join-Path "$unpackDir" "$setup64" $ErrorActionPreference = 'Continue' #if ($env:PROCESSOR_ARCHITECURE -eq 'AMD64') { $arch = (Get-WmiObject -Class Win32_ComputerSystem).SystemType -match '(x64)' if ($arch = "True") { $setup = $setupFile64 } else { $setup = $setupFile } try { Write-Host "Downloading Release" $release Get-ChocolateyWebFile $packageName $unpackFile $url $url64 Get-ChocolateyUnzip $unpackFile $unpackDir Install-ChocolateyInstallPackage $packageName $fileType $silentArgs $setup #delete downloaded file Remove-Item -Path $unpackDir -Recurse -Force -ErrorAction SilentlyContinue Remove-Item -Path $unpackFile -Force -ErrorAction SilentlyContinue } catch { throw $_.Exception Remove-Item -Path $unpackDir -Recurse -Force -ErrorAction SilentlyContinue Remove-Item -Path $unpackFile -Force -ErrorAction SilentlyContinue }