tsm_services_install

@echo off
setlocal
color 2F
title Installation of ISP services

rem version from 27.05.2013
rem change on 11.09.2014: possible start of TSM client acceptor
rem change on 14.06.2017: name change TSM -> ISP

set tsm_nodename=


rem registry path
rem -------------
set reg_path="HKEY_LOCAL_MACHINE\SOFTWARE\IBM\ADSM\CurrentVersion\BackupClient"

rem ISP option file
rem ----------------
set dsm_opt=dsm.opt

rem ISP service name
rem ----------------
set scheduler_name=TSM backup scheduler
set cad_name=TSM client acceptor

rem output texts
rem -------------
set text_continue=*** To continue press the return key ...
set text_error=*** To exit press any key ...
set text_passwd_fehler=*** If there are any error messages starting with "Error 2 ... password ..." can be ignored.


echo.
echo ================================
echo = Installation of ISP services =
echo ================================
echo.
echo The installation is done in four steps.

echo.
echo 1st step: Change to the ISP program directory
echo ---------------------------------------------------
echo.
rem set /p dummy=%text_further%


rem What is the ISP path?
rem ------------------------
for /f "tokens=3,4*" %%A in ('%systemroot%\system32\reg query %reg_path% ^| find /i "REG_SZ" ^| find /i "Path"') do set tsm_path="%%A %%B %%C"
if [%tsm_path%] NEQ [] goto TSMPATH
echo.
echo No entry for the ISP path was found in the registry.
echo Was ISP installed at all?
goto EXIT

TSMPATH
if exist %tsm_path% goto DSMOPT
echo.
echo The ISP program directory "%tsm_path%". 
echo was not found.
echo Possibly a wrong entry in the registry.
echo.
echo Please contact the backup team of the SCC.
goto EXIT

DSMOPT
echo.
echo The ISP program directory "%tsm_path%" exists.
cd /d %tsm_path%

if exist %dsm_opt% goto NODENAME
echo.
echo The ISP option file "%dsm_opt%" was not found.
echo First copy the options file to the directory
echo %tsm_path%
echo or correct the value of the variable "dsm_opt%" in this batch file if necessary.
echo of the variable "dsm_opt".
goto EXIT

:NODENAME
echo The ISP option file "%dsm_opt%" exists.
rem Determine ISP node name
rem ------------------------
for /f "tokens=2 eol=*" %%A in ('type %dsm_opt% ^| find /i "nodename"') do set tsm_nodename=%%A
if [%tsm_nodename%] neq [] goto PASSWORDACCESS
echo.
echo The ISP options file "%dsm_opt%" does not contain any
echo option "nodename".
echo Correct the ISP options file "%dsm_opt%".
goto EXIT

:PASSWORDACCESS
rem Determine the value of the "passwordaccess" option
rem --------------------------------------------
for /f "tokens=2 eol=*" %%A in ('type %dsm_opt% ^| find /i "passwordaccess"') do set tsm_passwordaccess=%%A
if /i [%tsm_passwordaccess%] neq ["generate"] goto INSTALL
echo.
echo The ISP options file "%dsm_opt%" contains for the
echo option "passwordaccess" contains an incorrect value (%tsm_passwordaccess%).
echo The value of the "passwordaccess" option must be 'generate'.
echo Correct the ISP option file "%dsm_opt%".
goto EXIT

INSTALL
echo The ISP options file "%dsm_opt%" contains the option "nodename".
echo The ISP node name is "%tsm_nodename%".
echo.
set /p dummy=%text_further%

echo.
echo Step 2: Install the "ISP Backup Scheduler" service
echo ------------------------------------------------------
echo.
rem set /p dummy=%text_further%

dsmcutil install /name:%scheduler_name% /node:%tsm_nodename% /autostart:NO /startnow:NO /password:tsm-password

echo.
echo.
echo %text_passwd_error%
echo.
set /p dummy=%text_further%

echo.
echo 3rd step: install "ISP Client Acceptor" service
echo -----------------------------------------------------
echo.
rem set /p dummy=%text_further%

dsmcutil install CAD /name:Êd_name% /node:%tsm_nodename% /cadschedname:%scheduler_name% /autostart:YES /startnow:YES /password:tsm-password

echo.
echo.
echo %text_passwd_error%
echo.
set /p dummy=%text_further%

echo.
echo 4th step: check if service "ISP Client Acceptor" started
echo ---------------------------------------------------------------
echo.
rem set /p dummy=%text_further%

for /f "tokens=4" %%A in ('dsmcutil query /name:Êd_name%' ^| find /i "current status"') do set cad_status=%%A

if /i "Êd_status%" == "Started" (
echo Service "Êd_name%" already started
echo.
echo.
set /p dummy=%text_further%
goto LIST
)
dsmcutil start /name:Êd_name%
echo.
echo.
set /p dummy=%text_further%

:LIST
echo.
echo 5th step: list of installed ISP services
echo -----------------------------------------------
echo.
rem set /p dummy=%text_further%

dsmcutil list


:EXIT
echo.
set /p dummy=%text_error%
endlocal
exit