The support forum

Scripted installation

Jul 18, 2016

Overview


Bvckup 2 installer can be run in automated mode that also includes an option of completely hiding its UI and running it "headless".

Version required


This feature was introduced in Release 76

Scripted installation


General idea is that all required configuration bits are put into an INI file and the installer is run as follows:

        bvckup2-setup.exe --install <settings-ini>

When launched this way, the installer skips first three pages of the setup wizard ("Welcome", "EULA" and "Settings") and proceeds directly to the installation phase.

Jul 18, 2016

Configuration file


The INI file is a basic text file, each line containing a single setting in a key-value format, e.g.

        install.group     Bvckup 2

For details see here - https://bvckup2.com/support/forum/topic/800.

The following are the settings recognized by the installer:

        install.as_admin         -  if to do machine-wide or user-centric install
        install.path                  -  where to put program files
        install.group               -  program group for Start menu, can be blank
        install.uninstaller       -  if to set up the uninstaller
        install.app_template  -  (see below)
        install.launch_app      -  if to launch the app once it's installed
        install.launch_app_as_admin  -  if to launch it elevated

        ui.mode                        -  controls the UI mode
        ui.console                     -  enables the log console if set to 1

Machine vs user installation


Setting install.as_admin to 1 tells the app to perform a machine-wide installation. More specifically it means that the setup will try and restart with full administrative rights (do the UAC elevation), it will add program group to the All Users' profile and set up the uninstaller entry under HKEY_LOCAL_MACHINE registry branch.

Conversely, setting install.as_admin to 0 will instruct the installer to run as is (with no attempt to elevate itself), the group will be created in the current user's profile and the uninstaller entry will go into HKEY_CURRENT_USER.

If you are to do a user installation into C:\Program Files and without explicitly starting the installer as Administrator, the setup *will* fail.

The uninstaller entry


Setting install.uninstaller to 1 will cause the installer to add a registry entry for Add/Remove Program applet in Windows Control Panel.

You would generally want to add this entry as it is required for the Bvckup 2 update mechanism to work. This is how the setup learns whether the app is installed on the machine and *where* exactly it is.

Populating app's configuration directory


Installer can be told to create and populate app's configuration folder by pointing install.app_template at a folder that contains files and directories to be copied over.

Specified folder must exist, but it may be empty. In this case, the setup will merely create %LocalAppData%\Bvckup2 folder and do nothing else.

Launching the app


If installation completes successfully, the installer can be told to launch the app right away. This is done by setting install.launch_app to 1.

By default, the app will be launched de-elevated, even if the installer itself was launched with full admin rights or if install.as_admin was specified.

Setting install.launch_app_as_admin to 1 will launch it, well, with full admin privileges, triggering an UAC prompt if the installer is running de-elevated.

Specifying the UI mode


Installer supports three UI modes - normal, quiet and hidden.

In normal mode the setup shows the "Installing..." window with the scrolling installation log and the window remains open once the setup is completed.

In quite mode the same window is display, but it is automatically dismissed if the setup completes *successfully*. If the setup fails, then window remains open to allow inspecting installation log

In hidden mode no window is displayed at all. If the setup fails, it fails quietly and the failure is indicated by terminating the process with a non-zero exit code.

In a true spartan fashion, "normal" mode is enabled by setting ui.mode to 1, "quiet" - to 2 and "hidden" - to 3.

Logging & troubleshooting


Setting ui.console to 1 tell the installer to open a console log window and, well, log all sorts of interesting information there. This is primarily meant for debugging scripted installs in hidden UI mode.

Alternatively, the log console can be opened by passing --console argument in the command line:

        bvckup2-setup.exe --console --install ...

---

Jul 18, 2016

Installing to run in service mode


Installing Bvckup 2 to run in a service mode is possible by combining several simple steps:

1. Prepare a file called bvckup2.ini with a single line in it:

        app_mode   1

2. Run the installer, setting install.app_template to the location of
    bvckup2.ini and setting install.launch_app to 0

3. Switch the app into the service mode with

        bvckup2.exe --set-mode service --just-service X:\foo

    This will install and launch bvckup2 service (the backup engine).

4. Launch the UI with bvckup2.exe

---

Command-line mode switching is described here:
https://bvckup2.com/support/forum/topic/799

Jul 18, 2016

Automatic activation


To automatically activate an installation once the app is deployed you can use the "activate" command:

        bvckup2.exe --command activate <activation-code>

See this post for details - https://bvckup2.com/support/forum/topic/411

ScottD-KMHA :

Jul 01, 2017

I hate to add confusion to a perfectly clean instruction thread, but I'm having trouble implementing this.  I've tried launching it via batch files and even a shortcut (with switches), but the bvckup2 setup process never even opens.

Batch File Name:  Install Bvckup2 for BC.bat

Batch File Content...

"C:\KMMI Files\Bvckup 2\bvckup2-setup.exe" --install "C:\KMMI Files\Bvckup 2\Custom_Install_Files\bvckup2_install.ini"
Pause
"C:\Program Files\Bvckup 2\bvckup2.exe" --set-mode service --just-service X:\foo

bvckup2_install.ini content...

install.as_admin 1
install.path "C:\Program Files"
install.group Bvckup2
install.uninstaller 1
install.app_template "C:\KMMI Files\Bvckup 2\Custom_Install_Files\bvckup2.ini"
install.launch_app 0
install.launch_app_as_admin 1

ui.mode 1
ui.console 1

Bvckup2.ini content...

app_mode   1

Can you tell me where I'm botching this up?  As it is now, I'm not even getting off the ground.  The end result is my hope to automate installation of Bvckup2 as a service.

Alex Pankratov :

Jul 03, 2017



install.app_template should point at a _folder_ that contains something that you want the installer to copy to the app's config folder.

Also, you can add --console at the front of the bvckup2-setup.exe argument list:

"C:\KMMI Files\Bvckup 2\bvckup2-setup.exe" --console --install "C:\KMMI Files\Bvckup 2\Custom_Install_Files\bvckup2_install.ini"

This cause the installer to open a console window and log the progress there:

    2017.07.03 12:29:33.279 (UTC+1) 3 Environment:
    2017.07.03 12:29:33.284 (UTC+1) 3   is_admin          1
    2017.07.03 12:29:33.287 (UTC+1) 3   elevation         2
    2017.07.03 12:29:33.289 (UTC+1) 3   needs_elevation   1
    2017.07.03 12:29:33.292 (UTC+1) 3   wow64             1
    2017.07.03 12:29:33.294 (UTC+1) 3   self              C:\Program Files\Bvckup 2\bvckup2-setup.exe
    2017.07.03 12:29:33.299 (UTC+1) 3   path_admin        C:\Program Files\Bvckup 2
    2017.07.03 12:29:33.303 (UTC+1) 3   path_user         C:\Users\alex\Program Files\Bvckup 2
    2017.07.03 12:29:33.319 (UTC+1) 3 Running in 'install' mode...
    2017.07.03 12:29:33.323 (UTC+1) 3 Checking settings...
    
    Completed with 1110
    
    Press Enter to exit...

Granted, the output is still cryptic. 1110 here stands for "installation path is empty or app_template is not a folder".

I made a note to document this better.

ScottD-KMHA :

Jul 03, 2017

Great.  Just what I needed.  It is working now and installing as a service (with all presets in place).  Thank you.

ScottD-KMHA :

Jul 03, 2017

Is there a way to specify what the Bvckup 2 Service "Log On" account will be?  I notice you now give the option, when switching to service mode in the UI, to use the default LOCAL SYSTEM account or to use an auto generated "Bvckup 2 Service" account.  Is there a way I can specify a specific user account / user password for the Bvckup 2 Service (service), from command-line, during this custom installation?  

For instance, I would like to assign the local built-in Administrator account as the Log On account for the Bvckup 2 Service (service).  Is that currently possible as part of the scripted installation?  Is that even possible directly from the Bvckup2 UI itself?

Alex Pankratov :

Jul 03, 2017

Is there a way to specify what the Bvckup 2 Service "Log On" account will be?


It's a binary choice between LocalSystem or "Bvckup 2 Service" accounts at the moment.

      bvckup2.exe --set-mode service --just-service X:\foo

will set up the former and

      bvckup2.exe --set-mode service --add-account --just-service X:\foo

will set up the latter.

Is that currently possible as part of the scripted installation?


No, not possible.

Is that even possible directly from the Bvckup2 UI itself?


No, not possible either.

However, there's this - https://stackoverflow.com/questions/966389/how-to-change-user-credentials-of-windows-service-from-command-line

New topic

Create
Made by Pipemetrics in Switzerland
Support


Follow
Twitter
Dev blog
Miscellanea Press resources
Testimonials
On robocopy
Company
Imprint

Legal Terms
Privacy