add update script for cloud backup

This commit is contained in:
2026-11-17 00:13:07 -05:00
parent f2830cb10a
commit 467f699103
8 changed files with 426 additions and 64 deletions
+8 -36
View File
@@ -1,15 +1,8 @@
# Specify URL to "Backup for Windows" agent installer
$ECB_WIN_URL = 'https://console.msp360.com/api/build/download?urlParams=OEFsMzhldm1SbjhaSDhBc2VtYkpUREM3Y2pJSzg0REU4dkVtR1pHREkxMGFFUk9qZXJnSXk5SUF0ei8wZlZOWTBzNG1zVDV0ckVMdStZVzBsam5uZklMVnZLeTBMVmxGNWt4VDhSMzNIL3VmK3VHNmxBVEZTQkxhMFhNR2ZuZzJCeE80MDJxVkRSWXdNa0dqSHdpbUN1bE01c3BWNFBVUmt2Q1c4endncjVZemFSSjEyYmFNL3hESHR2eWpVYXpBVlV2eU1kZVZFaEpvalk2Rk40Wk96UG9QdUwxYnZrRHREMmhLeTZoMW5Rbz0*&brandId=fb8308e2-448a-4645-a5f6-a3632a7e57f4'
# Specify URL to "Backup Virtual Machine Edition" agent installer
$ECB_VMM_URL = 'https://console.msp360.com/api/build/download?urlParams=OEFsMzhldm1SbjhaSDhBc2VtYkpUREM3Y2pJSzg0REU4dkVtR1pHREkxMGFFUk9qZXJnSXk5SUF0ei8wZlZOWUpYM2xDY3ErMkpOVGpuWTRISDNFcFRFdWRibDgvTm8vUDhpWndON3kzaHNwOTFVa3h6WUdoeVVod1JmT2lRQ1FlVTE3Y0pnUncwSEJwS3FFcDBmTWt3cEdnSy9YemRsSTRiQWJHNi96cUtWbzZsc25QVllaR1QyQ21VVS95dFFVTkNndXdPVStGQXBIT0FZb2FIUzFuZy9mMU5qZUd5emhab1hFYjZWODB4ND0*&brandId=fb8308e2-448a-4645-a5f6-a3632a7e57f4'
# Set the correct download URL and agent edition
switch ( $Edition.ToLower() ) {
'server' { $URL = $ECB_WIN_URL; $AgentEdition = 'baremetal' }
'desktop' { $URL = $ECB_WIN_URL; $AgentEdition = 'desktop' }
'vm' { $URL = $ECB_VMM_URL; $AgentEdition = 'vmedition' }
default { $URL = $ECB_WIN_URL; $AgentEdition = 'desktop' }
# Install and update use the same published Emberkom packages.
switch ($Edition) {
'server' { $CloudBackupBuild = 'Windows'; $AgentEdition = 'baremetal' }
'vm' { $CloudBackupBuild = 'VM'; $AgentEdition = 'vmedition' }
default { $CloudBackupBuild = 'Windows'; $AgentEdition = 'desktop' }
}
# Install and import additional Powershell module
@@ -21,30 +14,9 @@ If ( $(Get-MBSAgent -ErrorAction SilentlyContinue) ) {
Return
}
#
# The URL is now too long to pass as a variable to other functions and cmdlets, so this is a workaround to download the file
#
# Make sure the URL is valid
$StatusCode = [System.Net.WebRequest]::Create($URL).GetResponse().StatusCode
If ( !(($StatusCode -ge 200) -and ($StatusCode -lt 400)) ) { Write-Output "URL cannot be reached (status code ${StatusCode}): ${URL}" ; Return }
# Make a local file to download to
$Installer = '{0}EmberkomCloudBackup.exe' -f (Get-TempPath)
# Delete previous local file if it exists
If ( Test-Path $Installer ) { Write-Output "Deleting previously downloaded file: ${Installer}" ; Remove-Item $Installer -Force -ErrorAction SilentlyContinue }
# Download the file
Try { (New-Object System.Net.WebClient).DownloadFile($URL,$Installer) }
Catch { Write-Error $_.Exception.Message ; Remove-Item $Installer -Force -ErrorAction SilentlyContinue }
# Make sure the file exists
If ( !(Test-Path $Installer) ) { Write-Output "There was a problem downloading the file, this script will not continue" ; Return }
#
# End the workaround
#
$CloudBackupRelease = Get-EmberkomCloudBackupRelease -Build $CloudBackupBuild
$Installer = Join-Path (Get-TempPath) ("EmberkomCloudBackup-{0}.exe" -f [guid]::NewGuid())
Save-EmberkomCloudBackupInstaller -Release $CloudBackupRelease -Path $Installer
# Install the agent
Write-Output "Installing Emberkom Cloud Backup agent"