Synology Active Backup

PowerShell script to silently install the latest Synology Active Backup for Business agent.

Overview

Dev Insight: This script can also be used to update or reconfigure the Synology Active Backup for business agent.

The software applications available for Synology devices can be pretty powerful. One of my favorites, especially for internal IT, is Active Backup for Business (ABB).

From their Administrator's Guide:

ABB centralizes data protection across a variety of IT environments, including virtual machines, physical servers, file servers, and personal computers. Administrators can deploy their preferred protection plan single-handedly through ABB's centralized admin console.

ABB also offers a wide range of backup options and restoration tools, as well as a number of optional technical and safety features.

This script eases the deployment of the backup agent for Windows devices by silently downloading, installing, and configuring the agent on a device.

Prerequisites:

  1. Setup Active Backup for Business on your Synology NAS.

  2. Create a user account to authenticate the agent.

  3. Configure your default backup tasks.


Script

https://github.com/wise-io/scripts/blob/main/scripts/InstallSynologyActiveBackup.ps1
<#
  .SYNOPSIS
    Installs Synology Active Backup
  .DESCRIPTION
    Installs and configures the latest Synology Active Backup for Business agent.
  .PARAMETER Address
    The Synology server ip or hostname.
  .PARAMETER Username
    Synology username with permission to use Active Backup.
  .PARAMETER Pass
    Synology user password for username.
  .NOTES
    Author: Aaron Stevenson
  .LINK
    https://www.synology.com/en-global/dsm/feature/active-backup-business/pc
#>

param(
  [Parameter(Mandatory = $true)]
  [Alias('Host', 'Hostname', 'IP')][String]$Address,

  [Parameter(Mandatory = $true)]
  [Alias('User')][String]$Username,

  [Parameter(Mandatory = $true)]
  [Alias('Password')][String]$Pass
)

$Installer = "$env:TEMP\ActiveBackupForBusiness.msi"
$Arguments = (
  '/i',
  $Installer,
  '/qn', 
  '/norestart',
  "ADDRESS=`"$Address`"",
  "USERNAME=`"$Username`"",
  "PASSWORD=`"$Pass`""
)

function Get-DownloadURL {
  $ArchiveURL = 'https://archive.synology.com/download/Utility/ActiveBackupBusinessAgent'
  $ArchivePage = Invoke-WebRequest -Uri $ArchiveURL -UseBasicParsing
  $DownloadPageURL = 'https://archive.synology.com' + (($ArchivePage.Links | Where-Object { $_.href -like '*ActiveBackupBusinessAgent*' })[0]).href
  $DownloadPage = Invoke-WebRequest -Uri $DownloadPageURL -UseBasicParsing
  
  if ([Environment]::Is64BitOperatingSystem) { $OSType = 'x64' }
  else { $OSType = 'x86' }

  return ($DownloadPage.Links | Where-Object { $_.href -like "*$($OStype).msi" }).href
}

# Verify required values
if (!$Address -or !$Username -or !$Pass) {
  Write-Warning 'Unable to retrieve Synology Active Backup configuration information. Aborting...'
  exit 1
}

# Adjust PowerShell Settings
$ProgressPreference = 'SilentlyContinue'
if ([Net.ServicePointManager]::SecurityProtocol -notcontains 'Tls12' -and [Net.ServicePointManager]::SecurityProtocol -notcontains 'Tls13') {
  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
}

try {
  # Download ActiveBackup Agent
  $DownloadURL = Get-DownloadURL
  Write-Output $DownloadURL
  Write-Output 'Downloading Synology ActiveBackup agent...'
  Invoke-WebRequest -Uri $DownloadURL -OutFile $Installer

  # Install ActiveBackup Agent
  Write-Output 'Installing...'
  Start-Process -Wait -FilePath msiexec -ArgumentList $Arguments

  # Check for ActiveBackup Agent
  $Path = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
  $SynologyAgentInstall = Get-ChildItem -Path $Path | Get-ItemProperty | Where-Object { $_.DisplayName -like '*Synology Active Backup*' }
  if ($SynologyAgentInstall) { Write-Output 'Installation complete.' }
  else { throw 'Unable to detect Synology Active Backup agent.' }
}
catch {
  Write-Warning 'Failed to install Synology Active Backup.'
  Write-Warning $_
}
finally {
  Remove-Item $Installer -Force -ErrorAction SilentlyContinue | Out-Null
}

Examples

.\InstallSynologyActiveBackup.ps1 -Address "localhost" -Username "Backups" -Pass "Da ba dee da ba di"

This example downloads, installs, and configures the latest version of Synology Active Backup for Business agent.


Parameters

-Address

Aliases: -Host, -Hostname, -IP

Required string paramter that allows passing the hostname or IP address of the Synology device.

-Username

Aliases: -User

Required string parameter that allows you to pass the username required to authenticate with the Synology device.

-Pass

Aliases: -Password

Required string parameter that allows you to pass the password required to authenticate with the Synology device.

Last updated

Was this helpful?