Bacula Windows Client Automated Silent Install
  • Post category:Uncategorized
  • Post comments:0 Comments

Installing hundreds of Bacula Windows clients might be boring. The following batch script aims to keep things fast and print the newly File Daemon name and password after the execution and can be used for Enterprise and Community Bacula versions (change accordingly).

:: Optional hosts entries add
echo 192.168.0.51 baculadb01.bacula.com.br >> %windir%System32driversetchosts
echo 192.168.0.51 bacdirector01.bacula.com.br >> %windir%System32driversetchosts
::
:: Change path to your Bacula Windows installers
set BINARIES_PATH="\tsclientDownloads"
::
:: Other Path examples
:: set BINARIES_PATH="\mapped_folderMidiasBacula EnterpriseWindows8.8.5"
:: set BINARIES_PATH="C:UsersAdministratorDownloads"
::
:: Change your bacula client Version
set VERSION="8.8.5"
::
:: Change your Director name
set DIRECTOR="bacdirector01-dir"
::
:: Don't change this
set ARCH="win64"
if "%PROCESSOR_ARCHITECTURE%" == "x86" set ARCH=win32
::
:: Change/Add if Enterprise packages - runs client installer and desired plugins
%BINARIES_PATH%bacula-enterprise-%ARCH%-%VERSION%.exe /S|more
%BINARIES_PATH%bacula-enterprise-%ARCH%VssPlugin-%VERSION%.exe /S|more
%BINARIES_PATH%bacula-enterprise-%ARCH%MSSQLPlugin-%VERSION%.exe /S|more
::
:: Or uncomment and use the Bacula Community Name Example
:: %BINARIES_PATH%bacula-enterprise-%ARCH%-%VERSION%.exe /S|more
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Add 9102 Bacula Client Firewall exception
Netsh.exe advfirewall firewall add rule name="bacula-fd" localport="9102" protocol=tcp dir=in enable=yes action=allow 
::
:: Generates Random Client Password and resets configuration
set PASSWORD="%random%-%TIME%-%DATE%-%random%"
del "C:Program FilesBaculabacula-fd.conf"
::
:: Configures bacula-fd.conf
echo FileDaemon { > "C:Program FilesBaculabacula-fd.conf" 
echo Name = %COMPUTERNAME%-fd >> "C:Program FilesBaculabacula-fd.conf" 
echo FDport = 9102 >> "C:Program FilesBaculabacula-fd.conf" 
echo WorkingDirectory = "C:\Program Files\Bacula\working" >> "C:Program FilesBaculabacula-fd.conf" 
echo Pid Directory = "C:\Program Files\Bacula\working" >> "C:Program FilesBaculabacula-fd.conf" 
echo Plugin Directory = "C:\Program Files\Bacula\plugins" >> "C:Program FilesBaculabacula-fd.conf" 
echo Maximum Concurrent Jobs = 10 >> "C:Program FilesBaculabacula-fd.conf" 
echo } >> "C:Program FilesBaculabacula-fd.conf" 
echo Director { >> "C:Program FilesBaculabacula-fd.conf" 
echo Name = %DIRECTOR% >> "C:Program FilesBaculabacula-fd.conf" 
echo Password = %PASSWORD% >> "C:Program FilesBaculabacula-fd.conf" 
echo } >> "C:Program FilesBaculabacula-fd.conf" 
echo Messages { >> "C:Program FilesBaculabacula-fd.conf" 
echo Name = Standard >> "C:Program FilesBaculabacula-fd.conf" 
echo director = %DIRECTOR% = all, !skipped, !restored >> "C:Program FilesBaculabacula-fd.conf" 
echo } >> "C:Program FilesBaculabacula-fd.conf" 
::
:: Dequote password to easy copy and paste
SET NO_QUOTE_PASS=%PASSWORD:"=%
::
:: Restarts Bacula Client
net stop bacula-fd
net start bacula-fd
::
:: Prints clients name and generated password
echo %COMPUTERNAME%-fd%NO_QUOTE_PASS%

 

Disponível em: pt-brPortuguês (Portuguese (Brazil)) enEnglish

Leave a Reply