Install the Backblaze Client Silently (Windows)
    • Dark
      Light

    Install the Backblaze Client Silently (Windows)

    • Dark
      Light

    Article Summary

    For Microsoft’s line of Windows operating systems, pushing an application to hundreds of users generally involves an MSI package installer. The installers have a mechanism for copying to and running on supported machines, either by itself or as part of a script.

    The Backblaze MSI installer, when run on a user account, can determine the user’s email address from the domain’s Active Directory. The MSI installation process can then provide the authorization to install the backup client with the elevated privileges that are required for a backup program.

    If you have more questions, contact the Backblaze Business Account team.

    Decentralized Deployment (User-Managed Account)

    You should not provide an email address at runtime. Since email addresses are different per endpoint, the installer pulls them from Active Directory.

    • You must set up an Active Directory environment. 
    • If you do not have an Active Directory environment, you must fill in a relevant email for each deployment. You can use custom scripting with the PowerShell script that is mentioned below to actively pass these values in at runtime. 

    Decentralized deployments involve an account for each endpoint that is part of the business group that manages payment and admin activity (if enabled). In this scenario, the end user has access to their own data through the Backblaze portal.

    Centralized Deployment (IT Managed Account)

    You should hard code the primary email because it stays static.

    • This process skips the querying of Active Directory.

    For centralized deployments in which every endpoint is logged into a primary Backblaze account that is managed by IT, the end user does not have access to their data on Backblaze. They must contact the manager of that centralized account. These deployments are quite simple because the email that is passed to the installer does not change per endpoint.

    Use the MSI Package Installer

    Before you begin: You must have the following prerequisites.

    • Windows OS 7 or newer
    • An active Backblaze Group
    • A groupID and a groupToken
      These two values are required across all types of deployments. You can retrieve them from your Backblaze portal.

    Retrieve your groupID and groupToken

    1. Sign in to your Backblaze account.
    2. In the left navigation menu under Business Group, click Group Management.
    3. Navigate to the appropriate Group, and click Send Invites.
    4. Click Advanced Instructions.
      The two parameters at the end of the command are your groupID and groupToken values, respectively.

    MSI Installer

    You can find the most current version of the MSI installer here: https://secure.backblaze.com/win32/install_backblazemsi.msi.

    The MSI package is controlled through the following parameters that you pass through the command line.

    Install Mode: /i

    msiexec.exe /i install_backblazemsi.msi [email protected] BZGROUPID=***** BZGROUPTOKEN=***************
    • (Optional)  BZEMAIL=email
    • (Required) BZGROUPID=groupID
    • (Required) BZGROUPTOKEN=groupToken

    Uninstall Mode: /uninstall or /x

    msiexec.exe /uninstall install_backblazemsi.msi

    Use a PowerShell Script

    The MSI package is convenient for applications in which the use is static across all installations. The PowerShell script adapts to large deployments in which special considerations need to be made for endpoints. Most deployment tools allow pushes of PowerShell scripts to be run on endpoints. The script downloads the latest installer to a temporary directory (or a directory of your choice) from which it will run an installation, update, or uninstallation. 

    By using the PowerShell script around it, you can perform the following operations:

    • Create an account and install using hardcoded email values
    • Sign in an account and install using hardcoded email values
    • Create an account and install using email address values that are pulled from Active Directory
    • Sign in an account and install using email address values that are pulled from Active Directory
    • Update current installation
    • Uninstall current installation
    Click here to expand the PowerShell script.


    param( 
        [string] $groupID = "",
        [string] $groupToken = "",
        [string] $userEmail = "",
        [string] $workingDirectory,
        [string] $uninstall = "false"
    )
    
    #Create log if it doesnt already exist
    $LOGNAME = "Backblaze Powershell Deployment"
    if ( -not ( [System.Diagnostics.EventLog]::SourceExists($LOGNAME) ) ) {
        New-EventLog -LogName Application -Source $LOGNAME
    }
    
    [int]$global:eventIx = 1
    
    ##############################FUNCTIONS#################################################
    function logOutput {
        param( [string]$out )
        if ( $debug ) {
            write-host "[debug[${global:eventIx}]] $out"
        }
    }
    
    function global:echoOutput {
        param( [string]$out )
        Write-EventLog -LogName Application -Source $LOGNAME -EntryType Information -EventID $eventIX -Message $out
        logOutput "event ${global:eventIx}: $out"
        $global:eventIx = $global:eventIx + 1
    }
    
    function MyThrow {
        param( [string]$throwMessage )
        echoOutput $throwMessage
        Throw $throwMessage
    }
    
    function updateCheck {
        $software = "Backblaze";
        $installed = (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where { $_.DisplayName -eq $software }) -ne $null
    
        if($installed) {
            runUpdate
            exit
        }
    }
    
    function runUpdate {
        
    }
    
    function installBackblaze {
        $installCommand = "msiexec.exe /i install_backblazemsi.msi /quiet /l*vx! $BACKBLAZE_LOG_DIR BZEMAIL=$userEmail BZGROUPID=$groupID BZGROUPTOKEN=$groupToken"
        Invoke-Expression $installCommand
    }
    
    function installADBackblaze {
        $installADCommand = "msiexec.exe /i install_backblazemsi.msi /quiet /l*vx! $BACKBLAZE_LOG_DIR BZGROUPID=$groupID BZGROUPTOKEN=$groupToken"
        Invoke-Expression $installADCommand
    }
    
    function uninstallBackblaze {
        $uninstallCommand = "msiexec.exe /uninstall install_backblazemsi.msi /quiet"
        Invoke-Expression $uninstallCommand
        exit
    }
    
    ########################################################################################
    
    #Update Check
    
    #Uninstall Check
    if ( $uninstall -eq "true") {
        uninstallBackblaze
        exit
    }
    
    #Set installer filename
    $BACKBLAZE_INSTALLER = 'install_backblazemsi.msi'
    $BACKBLAZE_LOG = 'output.log'
    
    #Set install path
    if ( $workingDirectory ) {
        $BACKBLAZE_INSTALL_DIR = $workingDirectory
        $BACKBLAZE_LOG_DIR = join-path $BACKBLAZE_INSTALL_DIR $BACKBLAZE_LOG
    } else {
        $BACKBLAZE_INSTALL_DIR = "C:\tmp\backblaze_install_dir"
        $BACKBLAZE_LOG_DIR = "C:\tmp\backblaze_install_dir\output.log"
    }
    
    #Install path exists?
    $ret = test-path $BACKBLAZE_INSTALL_DIR
    echoOutput "BACKBLAZE_INSTALL_DIR [$BACKBLAZE_INSTALL_DIR] existence returned as ret [$ret]"
    if( -not $ret ) {
        New-Item -ItemType directory -Path $BACKBLAZE_INSTALL_DIR
        echoOutput "Temp directory created at [$BACKBLAZE_INSTALL_DIR]"
    }
    
    $msiPath = join-path $BACKBLAZE_INSTALL_DIR $BACKBLAZE_INSTALLER
    
    #Backblaze installer is present?
    if ( -not ( test-path -path "$msiPath" ) ) {
        Invoke-WebRequest -Uri "https://secure.backblaze.com/win32/install_backblazemsi.msi" -OutFile $msiPath
        echoOutput "Latest installer download to [$BACKBLAZE_INSTALL_DIR]"
    }
    
    #Check parameters
    if( -not $groupID ) {
        MyThrow "Error: groupID missing"
    }
    
    if( -not $groupToken ) {
        MyThrow "Error: groupToken missing"
    }
    
    Set-Location $BACKBLAZE_INSTALL_DIR
    
    if ( $userEmail ) {
        installBackblaze
    } else {
        installADBackblaze
    }


    Before you run the script, you must hard code a few values depending on the type of deployment you need:

    param( 
        [string] $groupID = "groupID", REQUIRED
        [string] $groupToken = "groupToken", REQUIRED
        [string] $userEmail = "email", OPTIONAL
        [string] $workingDirectory, OPTIONAL
        [string] $uninstall = "false"
    )

    <$groupID> and <$groupToken> are required parameters for the script to run properly.

    <$userEmail > is an optional parameter. If you leave this value blank, the script triggers the MSI installer to pull from Active Directory. If you do not have an Active Directory environment set up, then the email parameter is required.  

    This is where you can run custom scripting to port in emails at runtime from your own source.

    <$workingDirectory> is an optional parameter. Using this parameter, the script downloads and runs the installer at the specified directory. By default, the script creates a temporary working directory at:

    C:\tmp\backblaze_install_dir

    <$uninstall> is an optional parameter. Changing this to true sets the script to run an uninstallation of the Backblaze program on the endpoint.

    The script automatically runs an update on any endpoint if it finds that Backblaze is already installed. 

    Troubleshooting

    Note
    A successful installation results in a BZERROR:1001 message.

    The following output error codes indicate potential issues:

    • BZERROR:190
      The System Preferences process is running on the computer. Close System Preferences, and retry the installation. (This should not appear because the script should be closing.)
    • BZERROR:1000
      This is a general error code. One possible reason is that the Backblaze Installer does not have root permissions, and it is failing. See the install log file for more details.
    • BZERROR:1016
      The intended email address already has a Backblaze account, the group ID is incorrect, or the group token is incorrect.

    If you are unable to successfully install or you see a different error, contact the Support team. Provide Support with the install log from the computer on which you attempted a silent installation.

    If you have more questions, contact the Backblaze Business Account team.


    Was this article helpful?